nohup Execute command after closing shell script

Most of the time user login to remote server via ssh. If user start a shell command/script and exit (abort remote connection), process / command will get killed.
Even sometime job/command took longer time to execute. In such case user needs to run command/script in background even if remote connection aborts.

To accomplish such task user “nohup” command.
Use nohup utility which allows to run command/process or shell script that can continue running in the background after you log out from a shell:

nohup syntax:

           nohup command-name &

Where
        command-name: is name of shell script or command name. User can pass argument to command or shell script.
        & : nohup does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an & symbol.

Example:
1] Execute script called myscript.sh

             # nohup myscript.sh &


Leave a Reply

You must be logged in to post a comment.