[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

what is PPID = 1 means in ps -ef output

Posted on 2014-04-14
27
Medium Priority
?
2,305 Views
Last Modified: 2014-04-29
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
0
Comment
Question by:gaurav12345
  • 10
  • 9
  • 5
24 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40000053
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
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40000061
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
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 664 total points
ID: 40000094
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:gaurav12345
ID: 40000167
But my scp process stops . Still process seems runnning but scp is no more copying the files
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40000179
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
 

Author Comment

by:gaurav12345
ID: 40000208
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
 

Author Comment

by:gaurav12345
ID: 40000209
Only one sh in place of two sh in

nohup sh sh Datafile_copy_1.sh &  //5 script each
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40000249
so the processes are still running but no file copying?

is there any interaction for the scripts like providing password?
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40000255
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
 

Author Comment

by:gaurav12345
ID: 40000286
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
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40000306
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
 

Author Comment

by:gaurav12345
ID: 40000313
Yes i edited the original name .. To be secured
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 1336 total points
ID: 40000335
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
 

Author Comment

by:gaurav12345
ID: 40000365
Ok does using sh makes a difference in the way the process is being called
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 1336 total points
ID: 40000427
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
 

Author Comment

by:gaurav12345
ID: 40007578
Ok Thanks for the response .. it worked after putting -q
0
 

Author Comment

by:gaurav12345
ID: 40007739
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
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40007740
You should award points to the expert that helped you understand. Closing with 0 points choosing your own comment is not right.
0
 

Author Comment

by:gaurav12345
ID: 40007840
I am new to the site .How do i that .It was my first question
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40008295
@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
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40028964
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 40030093
What happened ?
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40030392
@Omar, asker closed, eenookami will handle this. If you have a different suggestion for closing this question, please post your suggestion.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40031141
@eenookami

Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question