How to get a unix script to run every 15 seconds?
If you insist of running your script from cron:
* * * * * /foo/bar/your_script
* * * * * sleep 15; /foo/bar/your_script
* * * * * sleep 30; /foo/bar/your_script
* * * * * sleep 45; /foo/bar/your_script
and replace your script name&path to /foo/bar/your_script
I would use cron to run a script every minute, and make that script run your script four times with a 15-second sleep between runs.
(That assumes your script is quick to run - you could adjust the sleep times if not.)
That way, you get all the benefits of cron
as well as your 15 second run period.
Edit: See also @bmb's comment below.
Modified version of the above:
mkdir /etc/cron.15sec
mkdir /etc/cron.minute
mkdir /etc/cron.5minute
add to /etc/crontab:
* * * * * root run-parts /etc/cron.15sec > /dev/null 2> /dev/null
* * * * * root sleep 15; run-parts /etc/cron.15sec > /dev/null 2> /dev/null
* * * * * root sleep 30; run-parts /etc/cron.15sec > /dev/null 2> /dev/null
* * * * * root sleep 45; run-parts /etc/cron.15sec > /dev/null 2> /dev/null
* * * * * root run-parts /etc/cron.minute > /dev/null 2> /dev/null
*/5 * * * * root run-parts /etc/cron.5minute > /dev/null 2> /dev/null