Forum Stats

  • 3,815,817 Users
  • 2,259,093 Discussions
  • 7,893,255 Comments

Discussions

cron seconds

Robeen
Robeen Member Posts: 2,175 Silver Badge

RHEL 7


Hello Team,


is it possible to schedule cron every 30 seconds?


Thanks,


Roshan

Answers

  • Christyxo
    Christyxo Member Posts: 151 Silver Badge
    edited Apr 23, 2021 10:19PM

    The minimum interval that you can put into a CRON job is a minute.

    As an alternative you could write a script that calls your original script twice with a sleep interval between the calls.

    Unless your script runs in a second though, this could lead to multiple iterations running at the same time so you'd also want to build controls into this.

    If you aren't restricted to CRON, you could review the SystemD Timer to run your scripts which could be specified to the second. I don't know enough about this to offer any guidance but take a look at the archlinux page which offers some examples https://wiki.archlinux.org/index.php/Systemd/Timers