LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 01: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, 01:37 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
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, 02:22 AM   #3
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
i believe running

Code:
nohup command1 | nohup command2 &
will be displayed by ps
 
Old 10-22-2013, 07: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, 07: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, 08:08 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

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

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
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



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 09:44 AM
How to run nohup with password? your_shadow03 Linux - Newbie 9 04-15-2012 05:45 AM
Difference between nohup and bg commands? tuhin_chatt Linux - General 2 05-08-2010 08:39 AM
How to test disown and nohup commands ? gjagadish Programming 2 03-21-2010 04:33 AM

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

All times are GMT -5. The time now is 05:42 PM.

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
Open Source Consulting | Domain Registration