The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 11:00 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
how could i make a program mixed with many "|", "<" and ">" strugglingman High Level Programming 2 04-29-2006 05:11 AM
No utpmx entry: you must exec "login" from lowest level "shell" peterpan UNIX for Dummies Questions & Answers 0 01-18-2006 12:15 AM
My "Bread and Butter" Process Keep Alive Perl Script.... Neo Tips and Tutorials 0 01-08-2005 01:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-10-2005
Registered User
 

Join Date: Sep 2003
Location: Paris
Posts: 109
Stumble this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-10-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,447
Stumble this Post!
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.
Reply With Quote
  #3 (permalink)  
Old 05-10-2005
Registered User
 

Join Date: Sep 2003
Location: Paris
Posts: 109
Stumble this Post!
Is INTR a flag or a command ?

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

thanks
Christian
Reply With Quote
  #4 (permalink)  
Old 05-10-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,447
Stumble this Post!
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.
Reply With Quote
  #5 (permalink)  
Old 05-11-2005
Registered User
 

Join Date: Sep 2003
Location: Paris
Posts: 109
Stumble this Post!
Thanks again for your help

Christian
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0