LinuxQuestions.org
Help answer threads with 0 replies.
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-04-2009, 11:32 PM   #1
matsko
Member
 
Registered: Dec 2005
Posts: 51

Rep: Reputation: Disabled
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, 12:07 AM   #2
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,133

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

Rep: Reputation: 69
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, 01:51 AM   #4
billymayday
LQ 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, 02:12 AM   #5
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: Disabled
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, 02:21 AM   #6
billymayday
LQ 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 08:22 PM
how to run GUI while logged in with ssh? kpachopoulos Linux - General 5 11-03-2004 04:28 PM
Cannot run basic commands unless Im logged on as root zwyrbla Linux - Newbie 4 08-22-2004 07:20 AM
Cron jobs, will they run when not logged in? nextekcarl Linux - General 18 03-30-2004 10:28 AM
Unable to run xfree86 unless logged in as root kdepa Linux - Security 9 02-28-2004 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration