Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Timer in a shell script
Name: Peter Date: October 25, 2002 at 18:05:45 Pacific OS: Redhat 7.3 CPU/Ram: pent 100 - 128meg
Comment:
I'm trying to write a shell script that acts as a watchdog timer. Basically it needs to look for a file being created by another process and if it finds it, it starts its timing cycle over. If it times out before seeing that file, it will run another script.
I know I can assign a variable X=`date +%S` as a starting point and I know how to check for the file, but I just can't seem to put it all together so it works.
Name: Rex Lopez Date: October 28, 2002 at 17:29:50 Pacific
Reply:
This is pigeon code on how u might layout script. It wakes up every second incrementing the timer and checking it against the timeout value. If the file is present, then the timer is reset. If ur using the old bourne shell (/bin/sh) u'll have to use expr for the maths.
TimeOut=30 Timer=0 while true do sleep 1 Timer=Timer+1 if FileExists then Timer=0 else if Timer = TimeOut then RunNewProg
Summary: Hi all, I'm writing a shell script to execute PGP, then FTP to several FTP site at the same time. Please let me know how to put in the script so that it'll automatic say y and don't promp me for it. ...
Summary: Hi, I have written a shell script in which I need to connect to sqlplus and execute some query there. In doing so on executing the shell script the query gets executed successfully but is not able to...
Summary: Hi, I need an urgent help with a complex situation. I really appreciate your help! I have a parameter file like this. unix> cat script.par name=david city=portland job=(admin,manager) admin_role=(call...