View previous topic :: View next topic |
Author |
Message |
nocturna_gr Tux's lil' helper
Joined: 04 Oct 2004 Posts: 96 Location: Athens, Greece
|
Posted: Fri Jul 15, 2005 8:52 pm Post subject: shutdown pc after i issue a command on a server? |
|
|
I, for example, connect to a server from my PC via ssh. I issue a command and then shutdown my PC.
Will the command keep being executed on the server?
Logically yes, but when i close an xterm window, or shutdown a PC, i don't think that is what really happens.
The question is general and applies for ftp, scripts and all other programs.
Are things different if i issue the command in the background (scriptname &, for example)?
Let experience speak.
Thanks |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54317 Location: 56N 3W
|
Posted: Fri Jul 15, 2005 9:16 pm Post subject: |
|
|
nocturna_gr,
You need to nohup the command as in Code: | nohup ./setiathome -nice 19 -proxy bloodnoc:5517 > /dev/null &
| which starts setiathome in the background and allows it to detach from its terminal.
See _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
racoontje Veteran
Joined: 19 Jul 2004 Posts: 1290
|
Posted: Fri Jul 15, 2005 9:27 pm Post subject: |
|
|
If you want to understand what's happening above: nohup will run a command and make it immune to several signals (man nohup) and '&' makes it run in the background. |
|
Back to top |
|
|
nocturna_gr Tux's lil' helper
Joined: 04 Oct 2004 Posts: 96 Location: Athens, Greece
|
Posted: Sun Jul 17, 2005 12:40 pm Post subject: |
|
|
I did "nohup rsync ..blabla... > /dev/null &". However, the following happens!
If i exit ssh first and the close the xterm window of the client, the command keeps running OK. But if i close immediately the xterm - that is not good as security concerns, is it?- the rsync stops. Why does that happen? |
|
Back to top |
|
|
chunderbunny Veteran
Joined: 31 May 2004 Posts: 1281 Location: 51°24'27" N, 0°57'15" W
|
Posted: Sun Jul 17, 2005 3:12 pm Post subject: |
|
|
The easiest way of dealing this is with a program called screen. It basically allows you "detach" a terminal session from your current console (whether locally or via SSH) so that it runs in the background. You can then reattach the screen session later. |
|
Back to top |
|
|
|