Overclockers Forums
 


Go Back   Overclockers Forums > Software > Alternative Operating Systems > [Linux Command line] problem
Reply


Welcome to the Overclockers Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

If you would prefer not to see any double-underlined words and corresponding advertisements without registering or logging in, place your cursor
here for ContentLink
 
Thread Tools
Old 11-05-09, 07:50 AM   #1
Ve'R
Registered



Join Date: Jan 2006
 
[Linux Command line] problem

Dear linux experts ,

I am having a little problem : i have a machine which i access through ssh.
And i want it to run a task for me. This is all great but when i want to close the ssh connection the task also stops.

How do i close the connection and still have the machine i ssh into run my task.

i have heard something about 'at' but have not found the proper syntax to make it work.

Thanks in advance

Ve'r
Ve'R is offline   Reply With Quote
Old 11-05-09, 08:58 AM   #2
splat
Cyber Deals Content Editor
once you 'clock, you can't go stock Senior

 
splat's Avatar 

Join Date: Apr 2002
Location: at home
 

__________________
______________________________/\/\__________________/\/\_____
_______/\/\/\/\__/\/\/\/\____/\/\____/\/\/\______/\/\/\/\/\__
____/\/\/\/\____/\/\__/\/\__/\/\________/\/\______/\/\_______
_________/\/\__/\/\/\/\____/\/\____/\/\/\/\______/\/\________
__/\/\/\/\____/\/\________/\/\/\__/\/\/\/\/\____/\/\/\_______
_____________/\/\___________
once you clock you can't go stock

PM me with your Cyber Deals articles and/or ideas to get published on the front page of Overclockers.com
splat is offline   Reply With Quote
Old 11-05-09, 09:30 AM   #3
Stratus_ss
Overclockers AltOS Content Editor

 
Stratus_ss's Avatar 

Join Date: Jan 2006
Location: Ontario Canada
 
Well technically using the ampersand ( & ) should background the process so that once you close the connection it continues to work.

so like

Code:
 sudo apt-get update &
will background the process.

However, while this works in Redhat, I have found that it does not work in Ubuntu for some reason.

you can use nohup instead. It will do exactly what you need

__________________
HEAT

Those wishing to contribute to the AltOS section front page please PM me.

Leviathan41: "Playing with a controller because the mouse and keyboard is too easy is like racing with a bicycle because a car is too fast."
Stratus_ss is offline   Reply With Quote
Old 11-05-09, 09:36 AM   #4
Trombe
Member

 
Trombe's Avatar 

Join Date: Mar 2005
Location: Austin, Texas
 
Quote:
Originally Posted by Stratus_ss View Post
Well technically using the ampersand ( & ) should background the process so that once you close the connection it continues to work.

so like

Code:
 sudo apt-get update &
will background the process.

However, while this works in Redhat, I have found that it does not work in Ubuntu for some reason.
The & technique will terminate on ssh logout no matter what distro you use

__________________
"Save yourself a lot of trouble and get a Mac. Get HP. Get an abacus. Anything but Gateway."
Trombe is offline   Reply With Quote
Old 11-05-09, 10:02 AM   #5
Ve'R
Registered



Join Date: Jan 2006
 
I have my tasks running as we speak , it is unaffected by my ssh connection

Thanks splat,Stratus_SS & Trombe
Ve'R is offline   Reply With Quote
Old 11-05-09, 10:40 AM   #6
Aynjell
Member

 
Aynjell's Avatar 

Join Date: Dec 2008
Location: Nebraska
 
Quote:
Originally Posted by Ve'R View Post
I have my tasks running as we speak , it is unaffected by my ssh connection

Thanks splat,Stratus_SS & Trombe
I don't think you can maintain a running task without an open session, although setting it up as a service or a cron job would probably work just fine.

__________________
MINE: 3800X2 @3.0 w\ CNPS7700, SLIDR, 2GB RAM, 8800GTS, 74GB Raptor, A2ZS, Antec 300, PCPC 510, Gentoo x64;
HERS: E5300 @3.6 w/ noctua, UD3P, 8GB RAM, GTX260, Seagate 320GB 7200.10, Panzer Box, OCZ 600, Win 7 x64;
AUDIO : Little Dot I+ w/ Mullard M8161 Small Shield Tubes, Grado SR325i w/ G Cushion Pads ("Bagels")
Aynjell is offline   Reply With Quote
Old 11-05-09, 11:22 AM   #7
MRD
Senior Member

 
MRD's Avatar 

Join Date: Feb 2003
Location: CT
 
The & will run it in the background, but the terminal is still the parent process, so when the parent process is killed, the process dies.

You should use nohup. Do a "man nohup"... basically it just says keep this process running even if the parent process is closed.

__________________
I do not support inline advertising in my posts!!! Click to read more.
I do not endorse any of the products, services or websites in the contextual ads being inserted in my posts. I urge you to refuse to support any company that uses these ads, and to use Mozilla Firefox and Adblock Plus (both freely available from the Firefox homepage) to block all such ads.
The decision to include inline ads was made by iNet in
direct violation of previous promises to the contrary, not by the administrators, moderators or other dedicated, volunteer forum staff who have always worked hard to maintain the integrity of the website and ensure a positive user experience.
MRD is online now   Reply With Quote
Old 11-05-09, 01:55 PM   #8
Ve'R
Registered



Join Date: Jan 2006
 
Indeed i am using the 'nohup' solution.
Ve'R is offline   Reply With Quote
Old 11-05-09, 02:50 PM   #9
splat
Cyber Deals Content Editor
once you 'clock, you can't go stock Senior

 
splat's Avatar 

Join Date: Apr 2002
Location: at home
 
screen lets you recall it to the foreground, like if you were running a game server. running a counter strike server was my first experience with screen and really the only time i needed it.

__________________
______________________________/\/\__________________/\/\_____
_______/\/\/\/\__/\/\/\/\____/\/\____/\/\/\______/\/\/\/\/\__
____/\/\/\/\____/\/\__/\/\__/\/\________/\/\______/\/\_______
_________/\/\__/\/\/\/\____/\/\____/\/\/\/\______/\/\________
__/\/\/\/\____/\/\________/\/\/\__/\/\/\/\/\____/\/\/\_______
_____________/\/\___________
once you clock you can't go stock

PM me with your Cyber Deals articles and/or ideas to get published on the front page of Overclockers.com
splat is offline   Reply With Quote
Old 11-06-09, 03:12 PM   #10
mbentley
Senior Member

 
mbentley's Avatar 

Join Date: Sep 2002
Location: indianapolis, indiana
 
+1 for screen. i am a big fan of being able to resume a session, especially since i am trying a LFS (linux from scratch) install and only work on it a bit at a time. much easier to be able to close out my ssh session and reestablish right where i left off.

__________________
core2quad
case/psu - antec p182 gun metal black w/fortron fx600-gln 600w
mobo - asus p5k premium/wifi-ap
cpu/hsf - intel core 2 quad q6600 b3 (sl9um) 2.4 @ 3.0 (9*333) w/asus v-60 vapo bearing hsf
ram - 4 x 1gb pc2 8500 5-6-6-18
hdd - 2 x seagate barracuda 7200.10 320 gb sata (raid 0) & 1 x seagate barracuda 200 gb ide
gpu - msi geforce 8800gts 640 mb
os - gentoo amd64, windows vista ultimate x64, & windows 7 (7000) x64

heatware | mbentley.net | ocf geforce survey
mbentley is offline   Reply With Quote
Old 11-07-09, 12:38 PM   #11
dropadrop
Member

 
dropadrop's Avatar 

Join Date: Mar 2001
Location: Finland
 
Screen or just write a script out of it and add it to cron.

__________________

folding for team 32


:sn:
dropadrop is offline   Reply With Quote
Old 11-14-09, 12:10 PM   #12
pdbogen
New Member

 
pdbogen's Avatar 

Join Date: Jul 2009
Location: Bryan, TX
 
Screen is by far the best solution for this. You have all the benefits of running interactively, but it won't stop if you close your connection, *and* you can reconnect later to check on it.
pdbogen is offline   Reply With Quote
Old 11-14-09, 01:32 PM   #13
Bobnova
Member

 
Bobnova's Avatar 

Join Date: May 2009
Location: Humboldt
 
Really? I've started FAH on ubuntu 9.04 with & over ssh and had it still running later.
Least i checked an hour later and it was still running.
I'll have to test again i guess.

__________________
E5200@3.7(337x11)@1.37vcore on Xig. HDT-s1283
Asus P5Q Pro w/modded bios
2x2gb OCZ ddr2-1124 5-5-5-15@1.8v(highly recommended! OCZ2P1066LV4GK)
320gb WD hdd
CORSAIR CMPSU-400CX
Sapphire 4830 w/ hacked up S1 V2+486 HSF ramsinks@700/1200
Old (~2002) ATX case
Ubuntu 9.04 64bit w/XP32 for gaming.

My heat.
Bobnova is offline   Reply With Quote
Old 11-14-09, 03:19 PM   #14
MRD
Senior Member

 
MRD's Avatar 

Join Date: Feb 2003
Location: CT
 
That's different... you ran a script that started fah... you can start/stop daemons using ssh and they continue after the shell has exited.

__________________
I do not support inline advertising in my posts!!! Click to read more.
I do not endorse any of the products, services or websites in the contextual ads being inserted in my posts. I urge you to refuse to support any company that uses these ads, and to use Mozilla Firefox and Adblock Plus (both freely available from the Firefox homepage) to block all such ads.
The decision to include inline ads was made by iNet in
direct violation of previous promises to the contrary, not by the administrators, moderators or other dedicated, volunteer forum staff who have always worked hard to maintain the integrity of the website and ensure a positive user experience.
MRD is online now   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:35 AM.


Top of PageLast Page

Home  |   Register  |   Calendar  |   FAQ  |   Search  |   Contact Us  |   Archive
Copyright © OCForums.com 2001 - 2008. All Rights Reserved.    Visit: Overclockers.com.    Advertise on OCForums


Other iNET Interactive Sites:
Web Hosting Talk | DB Forums | Mac-Forums | Hosting Catalog | Hot Scripts
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.