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 and shell scripting languages 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 03:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
how could i make a program mixed with many "|", "<" and ">" strugglingman High Level Programming 2 04-29-2006 09:11 AM
No utpmx entry: you must exec "login" from lowest level "shell" peterpan UNIX for Dummies Questions & Answers 0 01-18-2006 04:15 AM
My "Bread and Butter" Process Keep Alive Perl Script.... Neo Tips and Tutorials 0 01-08-2005 05:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-10-2005
Nicol Nicol is offline
Registered User
  
 

Join Date: Sep 2003
Location: Paris
Posts: 128
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 (permalink)  
Old 05-10-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
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 (permalink)  
Old 05-10-2005
Nicol Nicol is offline
Registered User
  
 

Join Date: Sep 2003
Location: Paris
Posts: 128
Is INTR a flag or a command ?

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

thanks
Christian
  #4 (permalink)  
Old 05-10-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
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 (permalink)  
Old 05-11-2005
Nicol Nicol is offline
Registered User
  
 

Join Date: Sep 2003
Location: Paris
Posts: 128
Thanks again for your help

Christian
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0