Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

putting program into background

There's an app that I start that I want to keep running after I log out. I do this by running something like:
  ./appscript.sh &
Then, I log out and it works fine.

However, I've found that if I run the above command and then don't log out that it'll work only until my session disconnects due to inactivity. At that point it hangs or dies or something.

It only sticks around after I disconnect if I purposely disconnect by typing exit.

This is annoying because in order to make sure it sticks around I always run it then log out then log back in so that I can check the logs to see how it's doing.

I want to know how to avoid having to log out in order to make sure it sticks around.
0
HappyEngineer
Asked:
HappyEngineer
  • 2
1 Solution
 
AutogardCommented:
Have you tried using "nohup"?  Type "man nohup" to see how it works.

Basically:

nohup ./appscript.sh &
0
 
AutogardCommented:
One more thing... this will redirect output to a default file.  If you don't want that file created, you can do a:

nohup ./appscript.sh > /dev/null &

or you can specify another file to send it to:

nohup ./appscript.sh > somefile.log &
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now