Pid still alive after "control C"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pid still alive after "control C"
# 1  
Old 05-10-2005
Pid still alive after "control C"

hi ,

i'm running 2 similar script (ksh) under AIX , the first go normally out when i type "control c" :
ps before :
notes01 19882 38990 0 11:54:48 pts/0 0:00 recover -s cla0bkpe -d /base/base01 -t May 05 23:02:17 2005 -v -f -a /base/base01/mail/mail-01/xxxx.nsf
notes01 30866 40880 0 11:53:24 pts/0 0:00 -ksh
notes01 38990 30866 0 11:53:55 pts/0 0:00 ksh /exploit/sun/notes/notes-recover

ps after => nothing

and the pid is killed when the 2nd got his pid alive :

ps before :

notes02 21492 49230 0 13:47:40 pts/0 0:00 nsrnotesrc -s pcyyesvg -ZZ -X -t May 03 23:00:26 2005 -d /base/base02 /base/base02/mail/mail-01/xxxx.nsf
notes02 39506 42214 0 11:20:11 pts/0 0:00 -ksh
notes02 49230 39506 1 13:47:11 pts/0 0:00 ksh /users/notes02/scripts/sad/util/notes_restaure.ksh

ps after :

notes02 21492 1 0 13:47:40 pts/0 0:00 nsrnotesrc -s pcyyesvg -ZZ -X -t May 03 23:00:26 2005 -d /base/base02 /base/base02/mail/mail-01/xxx.nsf




the first script extract:

..............
recover -s ${NWServ} -d ${Directory} -t "${NewDate}" -v -f -a ${Fichier} >> ${LOG} 2>&1 &
Pid=$!
x=0
while :
do
ps -u ${IDUSER} | grep -q "${Pid}"
[[ $? -ne 0 ]] && break
Result=$(ls -al ${Directory}/$(basename ${Fichier}) 2> /dev/null | awk '{print $5;}')
Result=$((${Result}*100/${Size}))
x=${x}+1
Sigle=$(print $((${x}%4+1)) | awk '{print substr("|/-\\",$1,1);}')
[[ ${TTY} -eq 0 ]] && (tput sc;printf "%s %s %%" ${Sigle} ${Result};tput rc)
sleep 1
done

..............

the second script extract:

.............

nsrnotesrc -s ${NWServ} -ZZ -X -t "${NewDate}" -d ${Directory} ${Fichier} >> ${LOG} 2>&1 &
Pid=$!
echo " PID"
echo $Pid
echo ""
x=0
while :
do
ps -u ${IDUSER} | grep -q "${Pid}"
[[ $? -ne 0 ]] && break
Result=$(ls -al ${Directory}${Fichier} 2> /dev/null | awk '{print $5;}')
Result=$((${Result}*100/${Size}))
x=${x}+1
Sigle=$(print $((${x}%4+1)) | awk '{print substr("|/-\\",$1,1);}')
[[ ${TTY} -eq 0 ]] && (tput sc;printf "%s %s %%" ${Sigle} ${Result};tput rc)

sleep 1
done
..........


Why in the second one , the script go out and the pid attached to the "1" father ?

Where is the mistake ?

thanks in advance

Christian
# 2  
Old 05-10-2005
It looks like nsrnotesrc is ignoring INTR. Any program can do that. It parent is not ignoring INTR. So the parent dies and the child survives. When a parent dies, the process is inherited by init.
# 3  
Old 05-10-2005
Is INTR a flag or a command ?

In my case , is there any solution except killing manually the process ?

thanks
Christian
# 4  
Old 05-10-2005
INTR is a signal. It is what gets sent to the processes when you type cntl c. The only other solution is to ask the author of nsrnotesrc to modify it so it does not ignore INTR.
# 5  
Old 05-11-2005
Thanks again for your help

Christian
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Tips and Tutorials

My "Bread and Butter" Process Keep Alive Perl Script....

For the newbies, I should have posted this years ago.... Here is the standard (tiny) "bread and butter" perl script (on Linux) I use in my crontab files to insure key processes are alive ( just in case ! ) like httpd, named, sshd, etc. The example below if for named...... ... (1 Reply)
Discussion started by: Neo
1 Replies

5. Shell Programming and Scripting

[SOLVED] Using "$!" to get the PID of the Last Ran Background Process

Hello All, I was looking into creating a script that would be used only to start a Daemon and create a lock file... F.Y.I. It's for Nagios' NRPE Daemon Plugin... Anyway when I run the command to start the Daemon (below): /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d And... (14 Replies)
Discussion started by: mrm5102
14 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Advanced & Expert Users

How to control remotely "full" Linux router in GUI ?

Hi, I mean Unix Linux general solution, so please don't move my question, as it's Unix specific. I would like to remotely control my "full" Linux router. Already succeeded to compile Linux Unix dialog, running some tests. The issue is dialog comes with a limited number of widget boxes for... (4 Replies)
Discussion started by: jack2
4 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. UNIX for Advanced & Expert Users

"kill -14 pid" doesn't works on all processes !!

If I try to run "kill -14 pid", some processes in my application get terminated , while some keeps running. If SIGALRM signal is sent, they should make an exit. What's the reason any process keeps on running. (1 Reply)
Discussion started by: poojac
1 Replies
Login or Register to Ask a Question