Archive for May, 2010

Killing all child processes in a shell script

If you have a shell script that runs a lot of jobs in the background, you will want to clean these processes up at the end of the execution ( say the user hits CTRL-C or kills the job). To do so is fairly easy if you know how to do it. No need to keep track of pids, just do kill 0 as part of the signal trap execution. eg.

#!/bin/bash

trap "kill 0" SIGINT SIGTERM

runprogram &
otherprogram &

wait

Found at: stackoverflow.com

Killing a stuck SSH or TELNET session

Useful thing I found today. To kill an ssh session that is hung (host down, network outage, etc… while ssh connected), just hit the enter key and type ~.

found at: serverfault.com

Also, to end a telnet session, you do CTRL-] and type quit.

found at: chipkin.com

Return top

INFORMATION

Change this sentence and title from admin Theme option page.