Link to home
Start Free TrialLog in
Avatar of gaurav12345
gaurav12345

asked on

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
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

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.
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 &
SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gaurav12345
gaurav12345

ASKER

But my scp process stops . Still process seems runnning but scp is no more copying the files
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
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
Only one sh in place of two sh in

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

is there any interaction for the scripts like providing password?
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)
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
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 >
Yes i edited the original name .. To be secured
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok does using sh makes a difference in the way the process is being called
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok Thanks for the response .. it worked after putting -q
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
You should award points to the expert that helped you understand. Closing with 0 points choosing your own comment is not right.
I am new to the site .How do i that .It was my first question
@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.
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"
What happened ?
@Omar, asker closed, eenookami will handle this. If you have a different suggestion for closing this question, please post your suggestion.
@eenookami

Thanks