stecklars
Posts: 27
Joined: Sat Mar 03, 2012 5:42 pm

Keeping process running after ssh session has been closed

Fri Jul 13, 2012 1:14 pm

Hi,

I hope that someone can help me. My idea is to use the Raspberry Pi as an uploader for Amazon S3.
I have to perform a large upload to Amazon S3 and would like to let the Pi perform it.
Basically I'd put the file that should be uploaded on an USB-Stick and insert it into the RPi. I set up the Pi for SSH access at my tv and then I connect it to my router without any TV or monitor connected to it.
Now I'd like to connect to it using SSH and start s3cmd which is a tool that is designed for uploading files to Amazon S3 on the command line.
But if I close the SSH session on my notebook now, s3cmd would be closed, wouldn't it?
That's not really useful as the reason why I would like the RPi to perform the upload is that I wouldn't have to run my computer 24/7 (with s3cmd/the ssh session opened)... So is there any way to avoid the process being exited when closing the SSH session?

Thanks for your help!
Lars

User avatar
RaTTuS
Posts: 10574
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 1:16 pm

see screen
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

stecklars
Posts: 27
Joined: Sat Mar 03, 2012 5:42 pm

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 1:20 pm

Thank you :-)

Sometimes you just can't find the right answer with all the information on the internet ;-)
Found a good tutorial here: http://www.howtoforge.com/linux_screen

rockhawk
Posts: 54
Joined: Thu Feb 09, 2012 9:24 pm
Contact: Website

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 2:23 pm

See also "nohup" if you don't want to leave the screen process and a shell running. But screen is good for lots of other reasons too.
Find Iridium Rising, our 3D space combat game, on the Pi Store!


User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 6:57 pm

Alex Eames RasPi.TV, RasP.iO

ferik
Posts: 15
Joined: Thu May 31, 2012 2:32 am

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 7:16 pm

Yeah, BYOBU (based on screen) is even better, check it out.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 8:17 pm

ferik wrote:Yeah, BYOBU (based on screen) is even better, check it out.
Will do - thanks. :D
Alex Eames RasPi.TV, RasP.iO

hilaryyy
Posts: 7
Joined: Fri Jul 13, 2012 1:48 am

Re: Keeping process running after ssh session has been close

Fri Jul 13, 2012 10:19 pm

Screen: a login session in screen is very useful for 'detaching' a session that stays running. you can reconnect to that session later or from another location. it's the console equivalent of having multiple "windows" as well. It's well worth reading up on.

nohup: leaves process/command running whether you logout or not. short for 'no hangup'.

&: runs the command in the background. not necessarily automation per se, but very useful when combined with nohup.

disown: a little advanced, but processes can be disowned and passed between owners. combine with judicious use of fg/bg for job management and it's pretty useful.

Return to “Beginners”