TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinux

How to run a command every seconds in Linux

We can schedule tasks in Linux using cronjobs. But the minimum time frame in cron is 1 minute. So we could not schedule commands to run in a time frame less than 1 minute.

But there are alternate ways to schedule commands to run in a time frame less that 1 minute.

Method1:

#while sleep 1; do command; done

Method2:

#watch -n1 command

 

That's all......

Leave a Reply