How do I run a sh script every x seconds?
I have a Linux server and I need to run a sh script with many commands every 5 seconds.
With a crontab, the minimum is 1 minute.
How can i do this?
Thank!
+3
Clément Andraud
source
to share
2 answers
maybe watch
Example
watch -n 5 foo.sh
+4
Steven penny
source
to share
You can also use sleep
in a loop in a shell script:
#!/bin/sh
while [ true ]
do
sh foo.sh
sleep 5
done
+4
Grijesh chauhan
source
to share