will child processes be created when executing "ps"?
Hi
I'm trying to write some code to confirm there is only one running instance in memory like below:
But sometimes i found there is some child processes are are created as below:
pid28796 is the program i launched, and the lower two are forked as child processes. the number of child process is 2-4.
I definitely sure that there is no "fork" in my script, as such issue is there even if i only keep this command in it. And ptree can never show the detail about it
does anyone know why there are multiple instances?
thanks in adv.
Last edited by Scott; 03-21-2011 at 12:17 PM..
Reason: Code tags, please...
Could you tell us a little more, such as which operating system and any more about the script you are look for. Different operaing systems have variations on the ps command and it would be worth seeing the script to look for anything that might cause child processes.
ps in itself should not cause your script to spawn processes, but it may find itself which can be random depending on how the process gets scheduled in by the OS e.g.
You can get out of this random catch by using square brackets to exploit the shell expansion:-
This will never match itself, but will find all variations of the phrase myscrip followed by anything in the brackets, um, that's a t then.
Let us know and hopefully someone can find the issue.
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)
Hi All,
i am trying to ssh to a remote machine and execute certain command to remote machine through script.
i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as
expect: spawn id exp5 not open
while executing
"expect "$" {... (3 Replies)
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)
Hello guys.
It is common knowledge that the directory /usr/openwin/lib contains standart “locale” directory which contains fonts for difference international locales.
But I have found in /usr/openwin/lib one more directory with name «local».
It contains the same iso_8859_1 directory with... (1 Reply)
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)
Consider this simple command line
bash -c 'echo $$ ; sleep 10000'This will print the newly created bash PID and sleep for a long time.
If I go to another terminal and do something like
ps -flax | grep leepI'll see something like
501 92418 91910 0 0:00.00 ttys000 0:00.00 bash -c echo $$... (5 Replies)
Hello,
When I tried to mount /appli21 with smit, the terminal "freezed" (ssh connection still active but always showing the same window, no new telnel or ssh connection allowed) and I had to have the machine restarted to be able to connect again.
my volum group datavg:
VOLUME GROUP: datavg... (8 Replies)
Hi everybody,
i'm using a signal handler for the SIGCHLD signal.
void InstallNewSigChldHandler()
{
struct sigaction act;
struct sigaction oldAct;
act.sa_handler = CallWaitChildProcess;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_NOCLDSTOP;
if... (5 Replies)
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)