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
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
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
2. UNIX for Dummies Questions & Answers
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
3. UNIX for Advanced & Expert Users
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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. Tips and Tutorials
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
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
9. AIX
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
LEARN ABOUT LINUX
nteventlog
nteventlog(3erl) Erlang Module Definition nteventlog(3erl)
NAME
nteventlog - Interface to Windows Event Log
DESCRIPTION
nteventlog provides a generic interface to the Windows event log. It is part of the OS_Mon application, see os_mon(7) . Available for Win-
dows versions where the event log is available. That is, not for Windows 98 and some other older Windows versions, but for most (all?)
newer Windows versions.
This module is used as the Windows backend for os_sup , see os_sup(3erl) .
To retain backwards compatibility, this module can also be used to start a standalone nteventlog process which is not part of the OS_Mon
supervision tree. When starting such a process, the user has to supply an identifier as well as a callback function to handle the messages.
The identifier, an arbitrary string, should be reused whenever the same application (or node) wants to start the process. nteventlog is
informed about all events that have arrived to the eventlog since the last accepted message for the current identifier. As long as the same
identifier is used, the same eventlog record will not be sent to nteventlog more than once (with the exception of when graved system fail-
ures arise, in which case the last records written before the failure may be sent to Erlang again after reboot).
If the event log is configured to wrap around automatically, records that have arrived to the log and been overwritten when nteventlog was
not running are lost. It however detects this state and loses no records that are not overwritten.
The callback function works as described in os_sup(3erl) .
EXPORTS
start(Identifier, MFA) -> Result
start_link(Identifier, MFA) -> Result
Types Identifier = string() | atom()
MFA = {Mod, Func, Args}
Mod = Func = atom()
Args = [term()]
Result = {ok, Pid} | {error, {already_started, Pid}}
Pid = pid()
This function starts the standalone nteventlog process and, if start_link/2 is used, links to it.
Identifier is an identifier as described above.
MFA is the supplied callback function. When nteventlog receives information about a new event, this function will be called as
apply(Mod, Func, [Event|Args]) where Event is a tuple
stop() -> stopped
Types Result = stopped
Stops nteventlog . Usually only used during development. The server does not have to be shut down gracefully to maintain its state.
SEE ALSO
os_mon(7) , os_sup(3erl)
Windows NT documentation
Ericsson AB os_mon 2.2.5 nteventlog(3erl)