?
Solved

what is PPID = 1 means in ps -ef output

Posted on 2014-04-14
27
Medium Priority
?
1,899 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 5
27 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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