Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-03-2007, 09:30 AM
|
#1
|
Member
Registered: Feb 2007
Posts: 197
Rep:
|
would script run after logout?
Hi,
If I run a script in backgrund, would it run after logout? Or do I need to provide special command? thanks in advance.
|
|
|
12-03-2007, 09:41 AM
|
#2
|
Member
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585
Rep:
|
nohup
nohup my_script &
|
|
|
12-03-2007, 09:42 AM
|
#3
|
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994
Rep:
|
Any program will be sent a HUP (hangup) signal when you logout.
Most programs, including scripts, will stop running if they get a HUP signal (unless they have been specifically coded to do otherwise).
You can stop a process from being killed by starting it with the nohup command. Just type nohup before the command to run.
This will rediect the standard ouput and error information to a file called nohup.out in the current working directory, and the program will be unaffected by logging out.
Hope that helps,
—Robert J Lee
|
|
|
12-03-2007, 11:21 AM
|
#4
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
An alternative is to use GNU screen. Again, you need to start this before you run the script. It allows you to "detach" your terminal session from the terminal window, and re-attach it at a later date. This is very handy for programs which are interactive, like an IRC client - you can run screen, start you IRC client, detach it from the terminal, log out, log in from another location and re-attach the screen session to your new terminal.
|
|
|
All times are GMT -5. The time now is 01:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|