Converting a cron job to a systemd timer
-
First some info as it may have impact on whether or not to do this in the first place:
I have a SaltStack deployment of 600-ish minions. Currently, I have a highstate set to run every 45 minutes via cron:
*/45 * * * * root /usr/bin/salt -b 25\% '*' state.apply
I know one of the benefits of systemd over cron is the logging, and I think this would be great to have better logging of when this runs. More can potentially be done with it automatically, like look for issues and send emails just as one easy example.
But I don't know how to test this... maybe it doesn't produce the kind of log I want, and salt may already do this in it's own log even better. Or maybe this will produce a log that's too big and cause issues later. I can watch it in the beginning either way, so it's fine.
Can that cron job be converted into a reliable systemd timer? If so, how?
-
Did you look at this thread yet?
https://mangolassi.it/topic/13455/systemd-timers-instead-of-cron -
@jaredbusch said in Converting a cron job to a systemd timer:
Did you look at this thread yet?
https://mangolassi.it/topic/13455/systemd-timers-instead-of-cronYeah a couple months ago. I knew there was something but didn't see it, search typo it was! Thanks.
Still I wonder if I should do it, but I suppose there's only one way to find out.
I'll try those instructions and post what I end up with.
-
@obsolesce said in Converting a cron job to a systemd timer:
@jaredbusch said in Converting a cron job to a systemd timer:
Did you look at this thread yet?
https://mangolassi.it/topic/13455/systemd-timers-instead-of-cronYeah a couple months ago. I knew there was something but didn't see it, search typo it was! Thanks.
Still I wonder if I should do it, but I suppose there's only one way to find out.
I'll try those instructions and post what I end up with.
Tags are your friend.
-
@Obsolesce said in Converting a cron job to a systemd timer:
First some info as it may have impact on whether or not to do this in the first place:
I have a SaltStack deployment of 600-ish minions. Currently, I have a highstate set to run every 45 minutes via cron:
*/45 * * * * root /usr/bin/salt -b 25\% '*' state.apply
I know one of the benefits of systemd over cron is the logging, and I think this would be great to have better logging of when this runs. More can potentially be done with it automatically, like look for issues and send emails just as one easy example.
But I don't know how to test this... maybe it doesn't produce the kind of log I want, and salt may already do this in it's own log even better. Or maybe this will produce a log that's too big and cause issues later. I can watch it in the beginning either way, so it's fine.
Can that cron job be converted into a reliable systemd timer? If so, how?
600ish minions. Wow. Curious about your setup. (Types of systems, types of states, how to manage and review output of all of that, etc.” Maybe an upcoming post?