LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-19-2013, 02:31 AM   #1
techie_san778
Member
 
Registered: Jul 2011
Posts: 90

Rep: Reputation: Disabled
Exclamation Which 2 commands to run in pipe using nohup ??


Hello Everybody !!

I want to run 2 commands in pipe, to run using "nohup", after i log out. The syntax is :

$ nohup [command1] & | nohup [command 2] &

I need to have 2 such commands that run for some time so that i can monitor them using the ps
command after i log out.

Can someone tell me which commands to use ?

Thanks in advance.
 
Old 10-19-2013, 02:37 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,528
Blog Entries: 6

Rep: Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437
Your question makes no sense as written.

Which "commands" totally depends on what you want to happen.

And how can you monitor them with ps after you logout? You are logged out!

Please try again to explain what you really want.
 
Old 10-21-2013, 03:22 AM   #3
ilesterg
Member
 
Registered: Jul 2012
Distribution: Arch, Debian, and CentOS/RHEL
Posts: 541

Rep: Reputation: 56
i believe running

Code:
nohup command1 | nohup command2 &
will be displayed by ps
 
Old 10-22-2013, 08:43 AM   #4
techie_san778
Member
 
Registered: Jul 2011
Posts: 90

Original Poster
Rep: Reputation: Disabled
Thanks ilesterg, i tested the format that u have mentioned to be working.
But in my case, i used the printf and cat command in this way :
$ nohup printf " ." | cat > output.txt &
But when i run ps, i am unable to capture the process IDs of cat and printf as they run
very fast.. which ps is unable to capture.
I therefore need two such commands whose PID's can be captured with ps while they are running.
Could you plz tell any 2 such commands ?
Thanks in advance !!
 
Old 10-22-2013, 08:46 AM   #5
techie_san778
Member
 
Registered: Jul 2011
Posts: 90

Original Poster
Rep: Reputation: Disabled
@astrogeek : the nohup command allows you to run commands even when u are logged off.
and one can monitor those processes with ps from another user's terminal..
 
Old 10-22-2013, 09:08 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,905

Rep: Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921
printf will be executed very quickly, you need to find something else (which runs longer). For example: ls -lR /
 
Old 10-22-2013, 02:49 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,528
Blog Entries: 6

Rep: Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437Reputation: 2437
Quote:
Originally Posted by techie_san778 View Post
@astrogeek : the nohup command allows you to run commands even when u are logged off.
and one can monitor those processes with ps from another user's terminal..
Yes, I know what nohup does, but was unclear about the using of ps from another user's login.

Try this:

Code:
nohup netstat -c | cat >/dev/null &
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
commands after nohup jobs finish ip_address Programming 5 03-28-2013 10:44 AM
How to run nohup with password? your_shadow03 Linux - Newbie 9 04-15-2012 06:45 AM
Difference between nohup and bg commands? tuhin_chatt Linux - General 2 05-08-2010 09:39 AM
How to test disown and nohup commands ? gjagadish Programming 2 03-21-2010 05:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration