run cron jobs more frequently

run cron jobs more frequently than once per minute

Sometimes you might encounter situations when you need to run cron jobs more frequently than least possible option provided by crontab (1 minute). Although you should consider converting such tasks into daemons, in some cases it might really be enough to just solve it “quick and dirty” way. Here is how.

Your script can be called with additional sleep interval before, e.g.

[root@linux ~]# crontab -l
* * * * * date >> /tmp/date.log
* * * * * sleep 30; date >> /tmp/date.log
[root@linux ~]# cat /tmp/date.log
Sun Oct 18 18:16:01 EEST 2020
Sun Oct 18 18:16:31 EEST 2020
Sun Oct 18 18:17:01 EEST 2020
Sun Oct 18 18:17:31 EEST 2020
Sun Oct 18 18:18:01 EEST 2020
[root@linux ~]#

Also keep in mind that if your script should not be executed more than once at the same time, you should introduce some sort of fuse mechanism for that.