Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

CentOS 6

I have a shell script that performs a task every minute. The task itself only takes a couple seconds to complete and ideally I'd like to have this shell script execute 2-3 times per minute. Is that possible to do with cron? Or is the fastest interval once every 60 seconds?

share|improve this question
    
have you tried , which posted ? –  Rahul Patil Mar 18 '13 at 8:00

2 Answers 2

cron's manpage says that

cron(8) examines cron entries once every minute.

so its resolution is 60 seconds by design. You could have a cron job that calls the script more than once, but you'll have to be careful that the jobs don't start overlapping each other in case the script takes longer than expected.

If you really need (say) execution every 30 seconds, you'd be better off wrapping your script in a loop and daemonising it. You'll have to write your own error handling, as you won't be able to rely on cron emailing you errors any more.

share|improve this answer

It's simple just use below syntax in cron

it will run if first run successfully then other and so on

* * * * *  /path/of/yoursript.sh && sleep 5s && /path/of/yoursript.sh && sleep 5s && /path/of/yoursript.sh 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.