LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-29-2006, 11:58 PM   #1
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
program running after logout?


howto to run program after logging out??
 
Old 09-30-2006, 12:41 AM   #2
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
Check out man nohup
 
Old 09-30-2006, 01:11 AM   #3
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Original Poster
Rep: Reputation: 30
this works...

nohup wget ftp://nohup.org/howto.iso & >> nohup.out
 
Old 09-30-2006, 01:18 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You don't need to use nohup for wget, it'll keep running when you logout AFAIK.
 
Old 09-30-2006, 09:01 AM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Or just use the mighty screen.

man screen

Better and more powerful in my opinion.
 
Old 10-04-2006, 06:25 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,655

Rep: Reputation: Disabled
Possibly a stupid question, but ...

When he wants to run something after logging out, that process won't need interactive input. So why not use "command &" and have done?

Where is my error?
 
Old 10-04-2006, 09:54 AM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Logging out will kill that process, I think.
 
Old 10-05-2006, 01:20 AM   #8
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,655

Rep: Reputation: Disabled
Why should it? Test:
  • start a(ny) process in the background
  • note the PID
  • logout
  • log in as root and have a look at the PID of your process
I just can't do it myself, I'm sitting in front of a windows box...
 
Old 10-06-2006, 10:51 PM   #9
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
Quote:
Originally Posted by JZL240I-U
Why should it?
As a rule of thumb child processes are terminated when their parent process ends.
 
Old 10-07-2006, 02:10 PM   #10
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by SlackDaemon
As a rule of thumb child processes are terminated when their parent process ends.
And to follow up with better detail, running a command with & at the end is just forking off the /bin/bash shell process when logged in, this is why it dies if you logout. Use screen or the nohup if you desire to logout before the command finishes.
 
Old 10-09-2006, 01:34 AM   #11
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,655

Rep: Reputation: Disabled
Aha, thanks, learnt something new .
 
Old 10-09-2006, 09:22 PM   #12
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: None (src & compile)
Posts: 253

Rep: Reputation: 36
Many shells have a "logout" script the runs after you logout. I use these to usually clear the display.

Tcsh and Csh have /etc/csh.logout.

Zsh has /etc/zlogout

I don't know about bash/ash, and I deny the existance of ksh since it doesn't have a nice prompt.

You can also use the "at" daemon to do stuff for you whenever. I've even upgraded an Openssh server , including restart, while logged in by that Openssh server.

Ex:

# at now + 2 minutes
at>(do something)
at>(do something else)

#

# logout

2 minutes later...(stuff)

I think also the "disown" command will let you logout while the process stays in the background (for Zsh).
 
Old 10-10-2006, 01:23 AM   #13
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,655

Rep: Reputation: Disabled
Interesting. Learnt again. Carry on anyone?

BTW, bash knows the "disown" too.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to logout under program control? sprezzatura Programming 1 04-17-2006 08:49 AM
Cygwin X logout, keep programs running poeta_boy Linux - Newbie 3 03-31-2006 02:52 PM
HELP: running process in bg and logout and persist... woes :S kevingpo Fedora 1 09-09-2005 01:10 AM
running in background hangs on shell logout pfaendtner Linux - Newbie 5 03-25-2005 10:34 AM
Keep task running after logout Xzanron Linux - General 3 12-14-2004 02:44 PM


All times are GMT -5. The time now is 08:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration