![two processes are listed for one shellscript?](https://rvso.com/image/1419604/two%20processes%20are%20listed%20for%20one%20shellscript%3F.png)
I have a shell script which does somewhat simple.
#!/bin/sh
do something boring...
When I execute the shell script like this,
$ nohup sh mysh.sh > /null/dev/ 2>&1 &
I see there are two processes listed.
$ ps -ef | grep mysh
... xxxxx 1 ... sh mysh.sh // same xxxxx
... yyyyy xxxxx ... sh mysh.sh // same xxxxx
Is this normal?
решение1
I just recreated what you have here and replaced do something boring...
with sleep 10000
and did not have this happen. I believe that you are doing something which uses fork() or clone() to create a child process. I had suspected that nohup ran the process as a child process but that does not appear to be the case.
решение2
As you can see, yyyyy is the child process of xxxxx. It is perfectly normal that the same shell script be executed inside "mysh.sh" which will result in such a scenario.
Are you directly/indirectly invoking mysh.sh inside the script? That's the only way I could think this will ever happen.