Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
shutdown pc after i issue a command on a server?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
nocturna_gr
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2004
Posts: 96
Location: Athens, Greece

PostPosted: Fri Jul 15, 2005 8:52 pm    Post subject: shutdown pc after i issue a command on a server? Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Fri Jul 15, 2005 9:16 pm    Post subject: Reply with quote

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
Code:
man nohup

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
racoontje
Veteran
Veteran


Joined: 19 Jul 2004
Posts: 1290

PostPosted: Fri Jul 15, 2005 9:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
nocturna_gr
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2004
Posts: 96
Location: Athens, Greece

PostPosted: Sun Jul 17, 2005 12:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
chunderbunny
Veteran
Veteran


Joined: 31 May 2004
Posts: 1281
Location: 51°24'27" N, 0°57'15" W

PostPosted: Sun Jul 17, 2005 3:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum