what is PPID = 1 means in ps -ef output

I have scheduled a job in the background .. Its a big scp job . As i exit the putty session and re-open another putty and query the ps -ef . I get output as

PPID = 1

ps -ef

root  192512       1

and my job no more running

Can some one please explain me the issue

Thanks
Gaurav
gaurav12345Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
Instead of calling the script with sh, can you try making the script executable first and then starting it directly, like this:

chmod 755 Datafile_copy_1.sh
nohup ./Datafile_copy_1.sh 2>&1 >Datafile_copy_1.log &
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
PPID = Parent Process ID

If you want to let your process run in the background, start it like this:

<your command> &

The & (ampersand) starts your command as a background process.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
If you want the output of <your command> to be saved, you can add output/error redirection by adding this:

<your command> 2>&1 >/path/output.txt &
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
omarfaridConnect With a Mentor Commented:
As a default, the init process (PID 1) is the parent of all processes without a parent process.

When a process is run from a login session, the shell it was run from is the parent process. When a shell exits, each child process will receive a SIGHUP signal, which causes the process to exit if a signal handler is not installed to deal with the SIGHUP signal. When a command is invoked with the nohup utility, the signal disposition for SIGHUP is set to ignored, allowing the process to continue executing when the shell exits. Then the parent for this process becomes init (PID 1).
0
 
gaurav12345Author Commented:
But my scp process stops . Still process seems runnning but scp is no more copying the files
0
 
omarfaridCommented:
can you show how run the command?

Also, run

ps -ef

before you logout and after you login again to confirm that the same process is still running
0
 
gaurav12345Author Commented:
Hi

I ran
nohup sh sh Datafile_copy_1.sh &  //5 script each

Before exiting putty

 oracle  540822 7286964   0 15:15:16  pts/3  0:00 sh Datafile_copy_2.sh
  oracle 5165218 7286964   0 16:18:44  pts/3  0:00 grep Datafile_copy
  oracle 7135476 7286964   0 15:15:03  pts/3  0:00 sh Datafile_copy_1.sh
  oracle 7176316 7286964   0 15:14:02  pts/3  0:00 sh Datafile_copy_4.sh
  oracle 7200990 7286964   0 15:15:10  pts/3  0:00 sh Datafile_copy_3.sh
  oracle 7389242 7286964   0 15:15:21  pts/3  0:00 sh Datafile_copy_5.sh


After Exiting putty

oracle  540822       1   0 16:20:16      -  0:00 sh Datafile_copy_2.sh
oracle 5165218 7286964   0 16:20:44  pts/3  0:00 grep Datafile_copy
oracle 7135476       1   0 15:15:03      -  0:00 sh Datafile_copy_2.sh
oracle 7176316       1   0 15:14:02      -  0:00 sh Datafile_copy_4.sh
oracle 7200990       1   0 15:15:10      -  0:00 sh Datafile_copy_3.sh
oracle 7389242       1   0 15:15:21      -  0:00 sh Datafile_copy_5.sh


You can ignore the time stamp

Thanks
Gaurav
0
 
gaurav12345Author Commented:
Only one sh in place of two sh in

nohup sh sh Datafile_copy_1.sh &  //5 script each
0
 
omarfaridCommented:
so the processes are still running but no file copying?

is there any interaction for the scripts like providing password?
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Try with redirecting output, your script could have some output that when not redirected cause the script to stop.

nohup sh Datafile_copy_1.sh 2>&1 >Datafile_copy_1.log &

(and for the other scripts as well)
0
 
gaurav12345Author Commented:
I had established ssh keys between the two server

This is inside the script

#!/bin/bash
START=$(date +%s)
scp /oracle/data1/cmorstby/*.* <server>:/db_cmorstg/data1
scp /oracle/data2/cmorstby/*.* <server>:/db_cmorstg/data1
scp /oracle/data3/cmorstby/*.* <server>:/db_cmorstg/data2
scp /oracle/data4/cmorstby/*.* <server>:/db_cmorstg/data2
scp /oracle/data5/cmorstby/*.* <server>:/db_cmorstg/data3
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "It took $DIFF seconds" >> /oracle/local/adhoc/gaurav/cmorstg_refresh/Datafile_copy_1.log
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
I assume you've edited out the real server names, right?

Otherwise you have an issue with the server names: <server> - with the redirection characters < and >
0
 
gaurav12345Author Commented:
Yes i edited the original name .. To be secured
0
 
gaurav12345Author Commented:
Ok does using sh makes a difference in the way the process is being called
0
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
Doesn't really make a difference, just the way I write/call scripts.

Are you sure your scp command is working? I wrote a simple test script that keeps running when launched the same way, after the terminal is closed.

You could try adding the -q parameter to your scp command line, this will disable progress, warning and diagnostic messages.
0
 
gaurav12345Author Commented:
Ok Thanks for the response .. it worked after putting -q
0
 
gaurav12345Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for gaurav12345's comment #a40007578

for the following reason:

The expert helped me understanding where my script might be failing
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You should award points to the expert that helped you understand. Closing with 0 points choosing your own comment is not right.
0
 
gaurav12345Author Commented:
I am new to the site .How do i that .It was my first question
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
@gaurav12345 - I didn't notice you were new, welcome @EE

You can change the way you close your question by using the 'Request Attention' button above, It's not available at the moment because I already requested attention. A moderator will attend the request and follow up with you.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
My suggestion would be to close this way:

http:#a40000094 - Assist - explanation of "PPID = 1"
http:#a40000335 and http:#a40000427 - Solution to "and my job no more running"
0
 
omarfaridCommented:
What happened ?
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
@Omar, asker closed, eenookami will handle this. If you have a different suggestion for closing this question, please post your suggestion.
0
 
omarfaridCommented:
@eenookami

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.