On Sat, Oct 26, 2013 at 10:59 AM, Jacob G Podipara <podi...@gmail.com>wrote:
> Dear Knights, > May seem to be a silly question. I would like to terminate a process like > say Herrie, Transmission > after an hour say. Can one do that while invoking the utility or is cron > necassary. The idea is > that I listen to quiet music while sleeping off. > Regards > Podi > PS. By the way can one post on Twitter from the CLI. > If you want to run a cron job to kill : $ ps aux | grep Herrie mohan 3992 99.9 0.0 1744 240 pts/0 R 11:55 11:58 Herrie mohan 4094 0.0 0.0 3780 780 pts/1 S+ 12:07 0:00 grep --color=auto Herrie Here is the shell script: $ cat kill_process1.sh #!/usr/bin/env sh process_name="Herrie" pid=$(ps aux | grep $process_name | grep -v grep | awk '{print $2}') if [ ! -z "$pid" ]; then kill -9 $pid exit 0 fi $ ./kill_process1.sh Thanks Mohan L _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc ILUGC Mailing List Guidelines: http://ilugc.in/mailinglist-guidelines