I have this command that I run from a terminal in ubuntu
python2.5 /home/me/web/gae/google_appengine/dev_appserver.py /home/me/web/gae/APPLICATION/trunk
I need to stop this running and then restart it every 10 seconds - I can run this from a .sh file if necessary.
What would be the best way to do this? I'd like it to all be in one script if possible so not that keen on using cron jobs to run it - surely there is some way of doing a loop with a delay in purely in a shell script?
The closest equivalent I can think of is JavaScript's setInterval(function(),10000);
You could try something like this:
while true; do
python2.5 /home/me/web/gae/google_appengine/dev_appserver.py /home/me/web/gae/APPLICATION/trunk &
sleep 10
kill $!
done
I.e.: Loop forever (while true
), start the python script in background, wait for 10 seconds (sleep 10
) and kill the background process (kill $!
).
I like ~$ watch -n sec command
i.E.
watch -n 10 ls /home/user/specialdata
watch -n 30 csync /dir/A /remote/dir/B
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With