Quiting running process without catching TRAP signal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Quiting running process without catching TRAP signal
# 1  
Old 06-01-2012
Quiting running process without catching TRAP signal

Hi, I would like to ask, if is it possible to quit running loop in the script any other way than catching the trap signal. Ctrl-C ends only current running instance of process but not whole script. Any clues?
# 2  
Old 06-01-2012
logon again in a separate session
Code:
ps -ef | grep smoofy

Code:
smoofy 20504 20108   0   Jun 01 ?           0:07 somescript

The red number is the pid in the example.

Code:
kill  20504

Change the red number to your real pid - or - turn off the trap while you are testing.
# 3  
Old 06-01-2012
Thanks for the answer, but to do that i do not even need to quit to another session do I? I can put process in the background and kill it afterwards. What I mean is find the way how to kill the script ASAP.
# 4  
Old 06-01-2012
Try fixing your script so it quits cleanly -- catching SIGINT itself to kill its subshells/subprocesses then quitting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Catching SIG of running process with bash

Hello all! I'm writing a script that will catch when an outside process crashes (SIGHUP, right?) without having to loop into infinity. With that in mind, I came across the trap utility and thought if could be used to monitor another process other than it's own. But from what I've read, I'm... (1 Reply)
Discussion started by: mashiox
1 Replies

2. Shell Programming and Scripting

How to Trap kill -9 signal

I just want to trap kill -9 signal issued by any of user from any terminal and just capture that user terminal who had raised this kill -9 command (1 Reply)
Discussion started by: puneet.goel
1 Replies

3. Programming

Signal catching

Hi! I want to catch all signals that my program receives print their name and then execute the default handler. Can you help me on that? I've tried the following code: #include <stdio.h> #include <unistd.h> #include <signal.h> void (*hnd)(int i); char signals = { "SIGHUP",... (7 Replies)
Discussion started by: dark_knight
7 Replies

4. UNIX for Dummies Questions & Answers

trap signal on user logout ?

hi all , I want to execute a script on the user logout(using gnome environment). Is ther any way to execute it through TRAP stmt? (2 Replies)
Discussion started by: harsha10
2 Replies

5. Programming

catching a signal from child process

i am creating children processes using fork system call every child i create goes to sleep for random time. when child stops running how can i catch his signal and turminate the child (2 Replies)
Discussion started by: emil2006
2 Replies

6. Shell Programming and Scripting

trap signal for enter key

hi , What is the trap signal for "ENTER key"? (4 Replies)
Discussion started by: Sreejith_VK
4 Replies

7. Shell Programming and Scripting

how to trap unix signal if the process killed/interupt occured in bash...

hey champs, I have a process running.......i have to catch/trap the signal when the process is being interupted/killed (kill -9 pid) option...... how can i achieve the same thru my process........ let my process is a.sh and it supposed to take 13 mins to complete, but due to some problem ,... (15 Replies)
Discussion started by: manas_ranjan
15 Replies

8. Programming

Catching signal and piping

Hi, Recently I was reading some c coding by some colleagues and I noticed that the above trend. They will create a pipe for the process then they will use the standard signal handler to capture a particular signal and write that signal to the pipe. On the other end, the process will read the... (7 Replies)
Discussion started by: joseph_ng
7 Replies

9. Shell Programming and Scripting

Fmli Signal/trap

Does anyone know how to program signals in fmli? My fmli script goes in loop when the telnet session is closed. When I start the script from the prompt the issue do not happen. But when it is started by the login process it hags. That's why I want to program the SIGHUP to exit/finish the script.... (0 Replies)
Discussion started by: Marcos Brito
0 Replies

10. UNIX for Advanced & Expert Users

how to make a current running process ignore SIGHUP signal?

I ask this question since sometimes i run a time-consuming ftp in foreground and forget to use nohup ftp.sh & to put this work background and can still running after i log off. Assume this ftp task have run 1 hour, and still 1 hour time to end, i don't want to abort the ftp, first, i use ctrl+Z... (3 Replies)
Discussion started by: stevensxiao
3 Replies
Login or Register to Ask a Question