Linux: nohup: Execute a command after exiting a shell


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

This is quite useful. I used to push jobs to the background and then exit shell, but it wasn’t an easy task considering I have short term memory issues (not a complete retard, just too much on my mind ;)). I found this awesome little command to have the commands or scripts run right after I’m off the wagon!

nohup

That’s it… simply run your comman with it:
nohup command

Don’t forget the ampersand at the end. Use absolute path for scripts:
nohup ~/script &

If your scripts requires additional options to run, use a quote right before the ampersand:
nohup ~/script "start" &

Note that you don’t need to use this for your wget command… wget comes with a built-in switch (b):
wget -b

Have fun!

2 thoughts on “Linux: nohup: Execute a command after exiting a shell


  1. Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
    Thomas says:

    Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

    A much smarter way to do it would be to run things like this in screen. It allows you to just detach the screen and go back later and look at what it did.


    • Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
      Ali says:

      Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

      Screen and nohup are like apples and oranges in my opinion.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.