Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: Dean Mumby on May 29, 2003, 11:42:59 PM
-
Hi
This is not so much an e-smith question , but I more of a linux question.
I have a script that rsyncs between two severs . The problem that I have is that my ip address is dynamic and changes at least once per day. This causes the rsync to stop. I have worked around this by creating a lock file which gets removed when my ip changes allowing the rsync which is started by cron to start again. Now I have "dead" processes when I do a ps ax
what I would like to do is stop the rsync process when the ip changes and then allow it to start again via cron.
Essentially that means I suppose I need to obatin the process id of the script as well as the rsync processes so that I can kill them.
if anyone could give me some guidance or point me to some docs I would appreciate it.
Regards
Dean
-
To find processes:
ps -ef |grep 'name of script'
to kill processes, use the command kill
so in a sort of one-liner:
ps -ef |egrep 'name_one|name_two' | awk ' { print $2 } ' | kill
Where name_one and name_two are the processe to kill. But watch out, name_one and name_two should be pointing only to the desired processes, all processes that contain name_one and name_two will be killed.
To be sure, test with the first part (up to the | awk part) to see if another process pops up.
If the normal kill doesn't do the trick, a kill -9 will .
-
Thanks I managed to figure out something similar after some googling.
Regards
Dean