How to configure systemd services to start/stop processes with predefined order and timeouts between their starts?

0

I use systemd to start/stop 4 services in sequential order by using Requires/After/Before/BindsTo fields.

systemctl start service01 initiat such start order:

service01 -> service02 -> service03 -> service04

stop action is configured thru BindTo at service0[234] side. They are bound to service01, so in case it's stopped, other services will be stopped as well.

But due to some problems, 5-10 sec delay should be configured between service02 and service03 start.

Is possible to use systemd for this?

Sure, I could just add "sleep 10" at the beginning of ExecStart in service03, but maybe there are some other ways to use systemd for this.

neOn

Posted 2017-09-28T14:46:08.213

Reputation: 1

Answers

0

There is timer units in systemd. Try using OnUnitActiveSec= option if you choose to use a timer for the task.

atype

Posted 2017-09-28T14:46:08.213

Reputation: 668