5

I am trying to schedule a service using systemd on Oracle Linux Server 7.7.

The use-case is simple; the timer needs to run the service in every hour (between 2PM and 9AM) - but, only if that is not running already. By this answer, I thought it is the case by default.

So, the expectation would be:

  • 2:00: timer starts the service - service begins to run and let's say it runs for 90 mins this time
  • 3:00: since the service is still running, do nothing this time
  • 4:00: service has completed around 3:30, so start the service again - service runs for 20 mins now
  • 5:00: timer starts the service again
  • ...

However, the current result is:

  • 2:00: timer starts the service - service begins to run and let's say it runs for 90 mins this time
  • 3:00: since the service is still running, do nothing
  • 3:30: the service completes, so it gets started again, immediately
  • ...

Could someone help me with this?

Thanks, guys!


my timer:

[Unit] Description=Run service between 02-21 (inclusive) every hour [Timer] # the 02..21 syntax didn't work on this distribution, but I am open to suggestions to simplify it :) OnCalendar=*-*-* 02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21:00:00 Unit=test-service.service [Install] WantedBy=timers.target 

my service:

[Unit] Description=Service for testing purposes [Service] WorkingDirectory=/opt/apps/long-running-service ExecStart=/opt/apps/long-running-service Restart=no KillSignal=SIGINT [Install] WantedBy=multi-user.target 

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.