12-01-2010
ssh a nohup command
I have a script I'm creating to spawn netcat listeners on a remote server for copying files at high speeds. The issue I'm running into is that after running the "nohup nc -l -p 12345 | tar -xvf - &" commands I can't get the remote shell to terminate. I'm not sure if this is working as intended or I'm missing something, but a simple test can reproduce the same results:
At a bash shell run the following:
nohup sleep 1000 &
exit
The shell clears screen and hangs until the sleep process is killed or finishes. If you check the process though you can see the shell is no longer the parent process:
[root@test ~]# ps -fea |grep sleep |grep -v grep
root 6990 1 0 12:15 ? 00:00:00 sleep 1000
So, beyond having a comment in my script to have users "ctrl-c" to continue, does anyone have a more elegant solution to kill the shell on the remote server?
Last edited by headcr4sh; 12-01-2010 at 05:22 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello All,
I am newbie to unix.I am trying to use NOHUP command in shell script it works fine with only "nohup test.sh 10 &" and "/opt/user/nohup test.sh 10 &" gives an error saying "ksh: /opt/user/nohup : not found".
Can anybody please guide me to make it work.
Thanks
Blazix (9 Replies)
Discussion started by: blazix
9 Replies
2. Shell Programming and Scripting
Hello, I need running the process from Oracle in backround.
Thank you for your help.
C.Abarca (1 Reply)
Discussion started by: cabarcaj
1 Replies
3. Shell Programming and Scripting
Hi
I am using nohup command in script(say nohup ls- ltr > somefile 2>&1 & ). I dont want any kind of output to be displayed on screen. When i tried the above nohup it still gives me some out put on screen like
2991
Done >somefile 2>&1
Please you let me know what is... (3 Replies)
Discussion started by: ammu
3 Replies
4. UNIX for Dummies Questions & Answers
Hello folks,
I have got a script which telnets to different boxes and runs a certain script with 3 run time args.
The line from the script which does it is:
(sleep 1; echo $USERID ; sleep 1; echo $PASSWD ; sleep 1 ; echo y ; sleep 1 ; echo "\r" ; sleep 1 ; echo "cd $FILEPATH" ; sleep 1 ; sleep 1... (1 Reply)
Discussion started by: Rajat
1 Replies
5. Shell Programming and Scripting
I want to know how to use a nohup command in the script........
I have to run following command
nohup /tmp/app/statuscheck.sh &
After typing this command I will type ctrl D to come to the prompt and the that command will run in backround.
Even after pressing & the command is not... (3 Replies)
Discussion started by: jayaramanit
3 Replies
6. UNIX for Dummies Questions & Answers
Hi..
Can anybody tell me, what exactly the nohup command does & when is it used?
Your help is appreciated. (3 Replies)
Discussion started by: Amol21
3 Replies
7. Shell Programming and Scripting
I'm trying to ssh into a remote server, run a script which may or may not start a nohup'd background process and then exit leaving the process running on the remote server. I'm looping through a number of servers to do this but the script hangs as soon as it comes to a server where the remote... (3 Replies)
Discussion started by: Steve_H
3 Replies
8. AIX
I'm trying to run a compress script in the background, but I even though the script is running in the background I get "Sending nohup output to nohup.out." and the screen just stays there. How can I make the script run in background and make my command prompt come back.
I was using:
nohup... (2 Replies)
Discussion started by: NycUnxer
2 Replies
9. Shell Programming and Scripting
I have a fairly simple script like so:
nohup java -jar program.jar >> log 2>&1 &
echo $! > pidfile
This works great when using ssh server "script.sh" but not when using ssh -t server "script.sh"
The solution I came up with was to call sleep after recording the child pid. My guess at the... (2 Replies)
Discussion started by: croachrose
2 Replies
10. Programming
Hello,
I am trying to find a way to send several sequential commands via SSH to a remote box in a single command.
Thoughts so far:
1) Can I put them into a function and call the function within the ssh command?
e.g.
ssh <targetserver> $(functionx)
No - then it calls the function in... (4 Replies)
Discussion started by: doonan_79
4 Replies