LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Which 2 commands to run in pipe using nohup ?? (https://www.linuxquestions.org/questions/linux-server-73/which-2-commands-to-run-in-pipe-using-nohup-4175481368/)

techie_san778 10-19-2013 01:31 AM

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.

astrogeek 10-19-2013 01:37 AM

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.

ilesterg 10-21-2013 02:22 AM

i believe running

Code:

nohup command1 | nohup command2 &
will be displayed by ps

techie_san778 10-22-2013 07:43 AM

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 !!

techie_san778 10-22-2013 07:46 AM

@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..

pan64 10-22-2013 08:08 AM

printf will be executed very quickly, you need to find something else (which runs longer). For example: ls -lR /

astrogeek 10-22-2013 01:49 PM

Quote:

Originally Posted by techie_san778 (Post 5050331)
@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 &


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