This is artificial as you set:
KillMode=process
but it helped me to realise how to approach it
This is artificial as you set:
KillMode=process
but it helped me to realise how to approach it
We do not need ExecStop
and to kill all spawned processes in timely fashion we set KillMode=mixed
and TimeoutStopSec=10
[Unit]
Description=RClone Backup
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
KillMode=mixed
TimeoutStopSec=10
ExecStart=/sh/sync.sh
[Install]
WantedBy=multi-user.target
Now on stop SIGTERM wil be sent to all processes and if they do not cooperate within 10s all will be killed with SIGKILL
"I" didn't set it. The OP set it as I was copying what the OP had by showing the impact on the setup with a simple test case.
Can you share the script that you use with cron? And also the crontab entry..?
I will try this one and see if it goes well.
Sure:
BTW when using systemd you do not have to check if the script is already running. Systemd takes care of it. Which means that instead of .sh
script spawning another process (rclone) you could directly put:
ExecStart=/path/to/rclone copy \
source: \
destination: \
--flag1 \
--flag1 \
--flagn
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.