set alarm in shell script
What is this stuff?
If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
Subject: Re: Is there a way to set an alarm in a shell script? References: <m04S7.firstname.lastname@example.org> From: email@example.com (John DuBois) Date: 14 Dec 2001 02:34:10 GMT In article <m04S7.firstname.lastname@example.org>, David H. Funte <email@example.com> wrote: >I have a script that uses ftp to transfer files in the middle of the night. > >The script hangs on an ftp transfer and sits there (occasionally) forever. > >Is there a way to set an "alarm" so that the command only runs for 3000 >seconds and then exits with an exit code $?. I'll write this in c if I >have to , but I'z (I wuz) just wondering if there is a current solution. > >For example: timed_run -t 3000 "ftp..." #!/bin/ksh ftp... & pid=$! ( ( sleep 3000& echo $! wait $! && kill -9 $pid )2>/dev/null & ) | read killerPID wait kill $killerPID
John -- John DuBois firstname.lastname@example.org KC6QKZ/AE http://www.armory.com/~spcecdt/
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Increase ad revenue 50-250% with Ezoic
Inexpensive and informative Apple related e-books:
Take Control of the Mac Command Line with Terminal, Second Edition
Yosemite Crash Course
Take Control of Numbers
El Capitan: A Take Control Crash Course
Take Control of Pages