LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Run linux script without having to be logged in (https://www.linuxquestions.org/questions/linux-software-2/run-linux-script-without-having-to-be-logged-in-716928/)

matsko 04-04-2009 11:32 PM

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?

mrclisdue 04-05-2009 12:07 AM

Code:

$ nohup ./script &
cheers,

raskin 04-05-2009 01:19 AM

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


billymayday 04-05-2009 01:51 AM

Or you may find the "at" command useful

matsko 04-05-2009 02:12 AM

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 :)

billymayday 04-05-2009 02:21 AM

at -f script.sh now


All times are GMT -5. The time now is 09:25 PM.