I don't see anything wrong there. You see that [1]+ Done ? The command is completing and returning before you run ps.
It's probably forking a copy of itself so it can put itself in the background automatically and return instead of hanging your shell. Daemons do that so often they call it 'daemonizing'. You might need another way to find its PID.
Look in /var/run/ for a file which might belong to it. Daemon processes often store their PID in a file somewhere under there for reference.
p.s. Here's a trick to stop grep from matching itself in a ps listing. ps | grep '[1]234'
I would agree with Corona688; the behaviour you describe fits to a process "forking itself into background". This means, you don't need the "&" in your command; run it, see it finish, and still see the daemon (with a PID higher by one on a calm system or "random" on a busy system) show up in ps.
When you run a pipeline in the background with &, the value assigned to $! is the pid returned by the fork() system call that the shell used to create the pipeline's last command's process (nrpe in this simple, single-command case).
If that last command itself forks (as nrpe does during daemonization) the value of $! will be the pid of the parent resulting from this second fork.
From nrpe.c @ sourceforge
After that fork(), the parent has nothing more to do and exits, while the child goes on to do the work of nrpe. This exiting parent process is the child process whose pid was saved in $!.
In the code there's a write_pid_file() function (line 1594) which refers to a "pid_file" config variable (line 581). You may want to have a look to see if you've set it to something. If not, do so and you can get the pid there.
I have never used nrpe. My pid config file suggestion is based solely on the code and not on experience.
Regards,
Alister
---------- Post updated at 04:49 PM ---------- Previous update was at 04:07 PM ----------
Quote:
Originally Posted by RudiC
... see the daemon (with a PID higher by one on a calm system or "random" on a busy system) show up in ps.
Some fork() implementations do not generate sequential pid values. I believe AIX is one of those. I am certain OpenBSD is.
Hey Corona, RudiC and alister, thanks for the replies!
Hey guys, great explanations!
Thanks alot for clarifying all this.... It makes much more sense to me now. I was kinda under the assumption that something
else was getting called from within the script (i.e. forking).
Alister,
Did you have to decompile nrpe in order to look at the code? I think I remember trying to look at it before and
it was definitely looking like compiled code (i.e. probably C, I think??)..?
Well anyway, thanks again guys for ALL your help with this..!!!
Thanks Again,
Matt
---------- Post updated at 10:35 AM ---------- Previous update was at 09:44 AM ----------
Ugghhh, Hey Corona, you were Correct!!!
I should have looked in here previously but guess what I found in "/var/run/..."?
Yup that's right lol, there is a PID file already in there for NRPE.... i.e. "/var/run/nrpe.pid"
Well, sorry for having to ask the question in the first place...
But I really appreciate ALL your guy's comments and help!
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)
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)
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)
I let a script A call script B.
I used
nohup a.sh &>/tmp/log &
In script A it calls B directly, without any redirecting or nohup or background.
However A is always "Stopped", while B is running correctly. Anybody knows why?
thanks!
-----Post Update-----
BTW, if I don't use nohup... (4 Replies)
I let a script A call script B.
I used
nohup a.sh &>/tmp/log &
In script A it calls B directly, without any redirecting or nohup or background.
However A is always "Stopped", while B is running correctly. Anybody knows why?
thanks!
-----Post Update-----
BTW, if I don't use nohup... (1 Reply)
Hello All,
I am a newbie in Shell script programming, and maybe you can help me with my query.
I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script.
The mntServer.ksh script contains:
#!/bin/ksh... (1 Reply)
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)
Hi,
I have a process that can be seen after "ps aux" command.
However when I do "top" command. This process
cannot be seen.
How can this happen? Is there anything wrong
with my code? (3 Replies)