Today's Posts

BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Kill the running program

kill, running, shell scripts

Login to Reply

Thread Tools Search this Thread
# 1  
Old 12-26-2008
Question Kill the running program

Dear All,

I have a script which after executing is not stoping when i press ctrl+c.
Now i want to Append the script in such a way when i press ctrl+c while execution of the program it should take it as arguements and should kill the script/running program forcefully.

I know the command to kill the the program Forcefully (kill -9 `ps -a | grep "ping_script" | awk '{print $1}'` )

Please help me to get out of this problem.
Advance Thanks,
Akhtar Bhat.
# 2  
Old 12-26-2008
Here is an example to trap INT signal ( Ctrl - C )

  echo "-- signal() --"
  echo "sleeping"
  sleep 1

trap signal INT

while :
  echo "here"
  sleep 1

Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command to know all the Current running process and how to kill skp Shell Programming and Scripting 7 12-29-2014 10:51 AM
Kill a program from bash arpagon UNIX for Dummies Questions & Answers 7 07-25-2014 02:34 PM
Script to kill a process running at a certain port baris35 Shell Programming and Scripting 7 07-19-2014 06:08 AM
Help with kill a specific process after certain running time perl_beginner Shell Programming and Scripting 5 03-11-2013 05:09 PM
kill a command I am running / then put it to background hindesite UNIX for Dummies Questions & Answers 3 08-10-2010 08:18 PM
Kill a running program? petel1 UNIX for Dummies Questions & Answers 3 05-26-2010 08:05 AM
Kill snoops running in background Pouchie1 Solaris 2 03-14-2010 03:09 AM
kill PID running in background in for loop mohan_xunil Shell Programming and Scripting 1 11-26-2009 07:36 AM
Kill shell script when host program not running/disk unmounted pcwiz Shell Programming and Scripting 2 10-02-2009 11:04 AM
See if process is running and kill it glev2005 UNIX for Dummies Questions & Answers 5 01-27-2009 05:47 PM
Trying to kill a program via help command. TiznaraN Shell Programming and Scripting 5 04-22-2008 01:57 PM
kill multiple instances of the same program ipzig Shell Programming and Scripting 12 12-17-2007 02:42 AM
kill textrdit program jeter Programming 6 06-07-2006 10:12 AM
C program to kill root processes TioTony Programming 8 07-25-2003 12:16 AM
how to kill process while keeping the submitted job running hk_newbie UNIX for Dummies Questions & Answers 3 06-02-2002 11:52 PM

All times are GMT -4. The time now is 03:02 AM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
Show Password