Cron – How to create a cronjob that runs every 15 seconds

cron

It seems that Cron doesn't support a seconds interval. What is the easiest way to run a cli script (php) every 15 seconds? Is there a cron tool that works specifically with seconds (then I could use Cron to call it every minute)?

Best Answer

You need to write a shell script like this that sleeps on the specified interval and schedule that to run every minute in cron:

#!/bin/sh
# Script: delay_cmd
sleep $1
shift
$*

Then schedule that to run in cron with your parameters: delay_cmd 15 mycommand parameters

Related Topic