Nohup – What this unix command does?

If you read my last post, you were able to see the command nohup to run some scripts.

Do you know what this command does?

When you execute a Unix job in the background ( using &), and logout from the session or turn off you pc, your process will get killed.

To avoid that you can use several methods — executing the job with nohup, or making it as batch job using at, batch or cron command.

This is the nohup syntax:

# nohup command-or-bash-script &

Other thing that you need to know is the nohup.out file. By default, the standard output will be redirected to nohup.out file in the current directory. And the standard error will be redirected to stdout, thus it will also go to nohup.out. So, your nohup.out will contain both standard output and error messages from the script that you’ve executed using nohup command.

In Summary: You can run a Command or Shell-Script after you logout using nohup command.

Don’t forget to register my newsletter.


No Comments

Post a Comment