[arch-general] Protect a cron job from systemd
Hello list, among various tasks, I also run "sysstat" for monitoring my server's load. The way it runs by default is via the hourly cron, as a job that lasts exactly one hour. Sometimes I need to stop crond (systemctl stop dcron) to perform some short maintainance, and restart it a minute later that I'm done. Previously the "sadc" monitoring process of sysstat wasn't being killed, since it double forked and stayed up as a daemon. Unfortunately now systemd kills the whole cgroup, and in this manner it's possible to lose up to one hour of accounting logs. Any ideas on how to instruct systemd to not kill it when terminating crond? Thanks in advance, Dimitris
[2013-01-02 11:07:01 +0200] Dimitrios Apostolou:
Any ideas on how to instruct systemd to not kill it when terminating crond?
Indeed, cron daemon services should use KillMode=process. I'll implement that for cronie and push it to [testing] right away. If you use another daemon, please create a bug on our tracker. Cheers. -- Gaetan
Hi Gaetan, On Wed, 2 Jan 2013, Gaetan Bisson wrote:
[2013-01-02 11:07:01 +0200] Dimitrios Apostolou:
Any ideas on how to instruct systemd to not kill it when terminating crond?
Indeed, cron daemon services should use KillMode=process. I'll implement that for cronie and push it to [testing] right away. If you use another daemon, please create a bug on our tracker.
Thanks, that's the solution I was looking for! Filed a bug for dcron (btw I hadn't noticed it moved to community, I thought it is still in core :-), see FS#33273. Dimitris
On Wed, 2 Jan 2013 11:07:01 +0200 (EET) Dimitrios Apostolou <jimis@gmx.net> wrote:
Hello list,
among various tasks, I also run "sysstat" for monitoring my server's load. The way it runs by default is via the hourly cron, as a job that lasts exactly one hour. Sometimes I need to stop crond (systemctl stop dcron) to perform some short maintainance, and restart it a minute later that I'm done.
Previously the "sadc" monitoring process of sysstat wasn't being killed, since it double forked and stayed up as a daemon. Unfortunately now systemd kills the whole cgroup, and in this manner it's possible to lose up to one hour of accounting logs. Any ideas on how to instruct systemd to not kill it when terminating crond?
Thanks in advance, Dimitris
As a sidenote: You could use a systemd timer unit instead of cron. You can start/stop them on a per unit basis instead of having to kill off the whole of cron.
participants (3)
-
Dimitrios Apostolou
-
Gaetan Bisson
-
Øyvind Heggstad