3 ms·
In my cronjob, I like to log the target process output, and ensure that only one timer jobs runs at a time, and apply resource limits, and have an easy way to k
by theamk 9y ago
In my cronjob, I like to log the target process output, and ensure that only one timer jobs runs at a time, and apply resource limits, and have an easy way to know if the job is still running.
Right now, I am doing this all with a mess of shell scripts (flock + logger + echo calls + pgrep). This is fragile and ugly.
Since systemd provides all of the above easily, a better approach will be one-off systemd jobs. In this case, my crontab entries would be a trivial -- "1 3 * * * root systemctl start cronjob1". This only requires scheduling functionality -- background execution, env vars, email notification and other things no longer matter.
From there, it is just one small step to move scheduling into the init process itself -- after all, compared to what other things init does, scheduling is both simple and safe.