ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Converting a cron job to a systemd timer

    IT Discussion
    systemd timers crontab saltstack
    3
    5
    1089
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Obsolesce
      Obsolesce last edited by Obsolesce

      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?

      AdamF 1 Reply Last reply Reply Quote 3
      • JaredBusch
        JaredBusch last edited by

        Did you look at this thread yet?
        https://mangolassi.it/topic/13455/systemd-timers-instead-of-cron

        Obsolesce 1 Reply Last reply Reply Quote 0
        • Obsolesce
          Obsolesce @JaredBusch last edited by

          @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-cron

          Yeah 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.

          JaredBusch 1 Reply Last reply Reply Quote 1
          • JaredBusch
            JaredBusch @Obsolesce last edited by

            @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-cron

            Yeah 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.
            0_1539984871117_9f552b7e-af67-4faa-a194-13ed2d23ae74-image.png

            1 Reply Last reply Reply Quote 1
            • AdamF
              AdamF @Obsolesce last edited by

              @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? 🙂

              1 Reply Last reply Reply Quote 0
              • First post
                Last post