Click to See Complete Forum and Search --> : How do I stop a process at a specific time?


dilligaf
04-10-2001, 01:44 PM
I know I can use at and cron to start a script running at a specific time, but is there a way to stop it as well?

Case:

I need to run a backup of a server over night.
I am using rsync. (very nice by the way)
The amount to transfer is from 0 to 6GB.
The connection is 56K Leased line. :eek:
The connection must be freed up during the day.

Obviously I have a potential problem if I just cron it to start at 9pm and it needs to transfer more than a Gig.

So... Is there a way to have something shut the process down if it was running too long?

Alternatively, Is there a better process to use than rsync?

Thanks.

jaque
04-10-2001, 01:54 PM
Try using the kill command in your crontab to kill the process that is running.

jaque
04-10-2001, 01:56 PM
Try using the kill command in your crontab to end the desired process.

dilligaf
04-10-2001, 02:51 PM
OK. When it is running I have 3 instances of rsync running. (2 are the process that needs killin', and one is the rsync daemon)

Short of killing them all and restarting the daemon, how do I do it?

Yes, I know that it would be no big deal at all to stop and restart the daemon. It just seems so... crude and clumsy. ;)

Thanks

X_console
04-10-2001, 03:01 PM
Haven't used rsync before. I suppose you could write a script to grep through the ps output and then individually kill the rsync processes. But this would probably take much longer than killall -HUP rsync

dilligaf
04-10-2001, 05:11 PM
Rsync is cool, assuming you have a need for it. It is wicked fast. Though it will consume a chunk and a half of memory if you have a lot of files to sync up. Right now I'm burning 36 Meg of ram on a 9+ Gig sync. But it only takes 3 minutes to do it plus any actual file copy times. (100 Mbps LAN, Novell to Linux, both systems drives are running around 25Mbps, sustained)

Anyway, thanks to you both for pointing what should have been REALLY obvious.

However, I'm still looking for that esoteric one liner that does it all. :p