#!/bin/csh ############################################################### # This script kills any currently-playing musicbox programs. ############################################################## ############################################################## # The -C tells it to list processes by command. The -o sets # the output format, with the = meaning no header. First kill # the play jobs, then any sox jobs that they started. set jobid = `ps -C musicbox_play.txt -o pid=` if ( `echo -n $jobid | wc -c` > 0 ) then kill -TERM $jobid >& /dev/null endif set jobid = `ps -C sox -o pid=` if ( `echo -n $jobid | wc -c` > 0 ) then kill -TERM $jobid >& /dev/null endif ############################################################## # Delete the now_playing file because we just stopped it from # playing. set playstate_file = `musicbox_state_directory.txt`/now_playing \rm -f "$playstate_file" exit 0