Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
|
 |
04-04-2009, 11:32 PM
|
#1
|
Member
Registered: Dec 2005
Posts: 51
Rep: 
|
Run linux script without having to be logged in
Is is possible to start a script and then not have to be logged in with SSH?
> login to server
> ./script &
> exit
this causes the script to end, but is it possible to still allow the script to continue even if the user has logged out?
|
|
|
04-05-2009, 12:07 AM
|
#2
|
Senior Member
Registered: Dec 2005
Distribution: Slackware
Posts: 1,135
|
|
|
|
04-05-2009, 01:19 AM
|
#3
|
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
|
Another useful command is disown (available in many shells). It is useful when you start command first and think about leaving it running after logout second.
Code:
./script
[Ctrl-Z]
bg
disown
exit
|
|
|
04-05-2009, 01:51 AM
|
#4
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Or you may find the "at" command useful
|
|
|
04-05-2009, 02:12 AM
|
#5
|
Member
Registered: Dec 2005
Posts: 51
Original Poster
Rep: 
|
Yeah I thought about using the at command, although it would require me to set a time and sit there to see if it works.
---
the nohup command worked perfectly thanks 
|
|
|
04-05-2009, 02:21 AM
|
#6
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
at -f script.sh now
|
|
|
All times are GMT -5. The time now is 05:43 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
|
|