[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash script problem



Hello,

 
> > I have a problem with a bash script. The script (example) is very 
simple:
> > 
> > #!/bin/bash
> > 
> > echo hello
> > ssh PT-AGCMLX1 "while true; do date; sleep 10s; done" 
> [..] 
> > How can I change my script so that it kills all its child processes, 
if it 
> > is killed itself ? I tried to use the "trap" function of bash, but it 
> > never used the correct pid...
> 
> Have you tried to use "exec ssh PT-..." instead? 

No, I didn't know that. It's interesting, but unfortunately I can't use 
that. I need to be able to kill the script via "killall script.sh" and 
after the exec, script.sh isn't there anymore. I could use 'exec -a 
script.sh', but the killall command won't work either...

But thanks for the 'exec' tip, I learned something new :)

Markus Grunwald
Softwareentwicklung

PRÜFTECHNIK Condition Monitoring GmbH
Oskar-Messter-Straße 19-21
85737 Ismaning
www.pruftechnik.com
Tel: +49 (0)89 99616177
Fax: +49 (0)89 99616200




Reply to: