LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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

Reply
 
Search this Thread
Old 04-05-2009, 12:32 AM   #1
matsko
Member
 
Registered: Dec 2005
Posts: 51

Rep: Reputation: 15
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?
 
Old 04-05-2009, 01:07 AM   #2
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,049

Rep: Reputation: 170Reputation: 170
Code:
$ nohup ./script &
cheers,
 
Old 04-05-2009, 02:19 AM   #3
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
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
 
Old 04-05-2009, 02:51 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Or you may find the "at" command useful
 
Old 04-05-2009, 03:12 AM   #5
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: 15
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
 
Old 04-05-2009, 03:21 AM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
at -f script.sh now
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto run bash script when logged in linuxmandrake Fedora 1 06-11-2005 09:22 PM
how to run GUI while logged in with ssh? kpachopoulos Linux - General 5 11-03-2004 05:28 PM
Cannot run basic commands unless Im logged on as root zwyrbla Linux - Newbie 4 08-22-2004 08:20 AM
Cron jobs, will they run when not logged in? nextekcarl Linux - General 18 03-30-2004 11:28 AM
Unable to run xfree86 unless logged in as root kdepa Linux - Security 9 02-28-2004 04:58 PM


All times are GMT -5. The time now is 02:50 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