Run a cron job every x seconds

As most of you know, the smallest time a cron job can be configured to run is every minute.
To run a script every 15 seconds for example, you could use the following:

main cron job:

* * * * * /path/to/wrapper.sh

wrapper.sh:

/path/to/script &
sleep 15
/path/to/script &
sleep 15
/path/to/script &
sleep 15
/path/to/script &

If you can suggest any nicer alternatives to this example, please let me know. :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">