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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
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,990
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:56 PM.
|
|
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
|
|