Python is a great language and can solve a variety of problems. But sometimes, a plain shell script will do just fine.
#!/bin/bash # # drop_csm_users.sh -- grabs anyone running fglgo csm and kills their # process. This must run under root's user, no matter who calls it. # This has to run and allow sqlexecd to continue running. It's a little # bit different than drop_ics_users.pl # # Change History: # cat /dev/null > /tmp/csm_users ps -ef | grep -v 'grep' | grep 'fglgo csm' > /tmp/csm_processes RC1=$? if [ $RC1 -eq 0 ]; then while read line do echo -e "$linen" ccmd=`echo $line | cut -b 8-14` kpl="kill -9 $ccmd" echo "Forking this kill command $kpl" $kpl done < /tmp/csm_processes fi