Run cron job every two seconds

Hello,

I wonder how I can set a cron job to run every two seconds. Under “Webmin > System > Scheduled cron job” I can set a script to run every minute, but not every two seconds.

How do I accomplish this?

Greetings Fredrik-s

Just read that this is not possible.

One work around is to make a loop with a sleep function. Counting down.

Howdy,

Yeah, you’re correct, Cron doesn’t handle frequencies less than one per minute.

As you saw – the only way to do that would be to write some code of your own that handled running your program every two seconds.

-Eric

Considering that cron needs to start processes for the tasks it performs, it’d probably not be a good idea to have it run something every two seconds, even if it was possible. :slight_smile:

A loop script that stays active and yields CPU cycles for two seconds each time it finishes its thing is much better.