bash script to stop isdn service after x minutes?
I am looking for a script to stop my isdn service or ippp0 interface after x number or minutes. Eg stopthisservice.sh 30. I am struggling to get the basics sorted out like how to measure elapsed time in a bash script etc. I am thinking of a simple script eg:
while timenow < timetoelapse do timenow = now + elapseperiod done serivce isdn stop Any ideas where I could look for help Tx p.n |
Have the script 'sleep' for 30 minutes.
|
You could also use a two-stage script. Whereby stage one works out the time now plus your input, and calls `at' to perform the second stage of the script at the requested time. The second stage could then actually pull down the connection. Just an idea.
|
You don't need to work out the interval,
echo kill_scrip.sh | at now + 30 minutes see 'man at' you can keep recursivly calling the script in itself of course. atq tells you what's on the at queue. |
Or even simpler,
while kill_script.sh; do sleep $(( 30 * 60 )); done & or better probably... while sleep $(( 30 * 60 ));do kill_script.sh ; done & regards, billy |
All times are GMT -5. The time now is 02:34 AM. |