How to run Linux commands in background even when you logout?
Ans : In Linux/nix by default we cant run the commands in background when we logged. When we try to logout form terminal you will get following error.
surendra@linuxnix.com:~$ exit
There are stopped jobs.
Supose you have logged in to a remote system by using ssh, after starting a script there you thought of logging out from that terminal but the script is still running. At this point we want to run the script even we loggedout.
What we can do is to run a process background though you have logged out ?
This can be achived by using the nohup command. Below is the man help for nohup.
No Hang Up. Run a command immune to hangups, runs the given command with hangup signals ignored, so that the command can continue running in the background after you have logged out.
Syntax:
nohup Command [Arg] &
Example1:
nohup ping google.com &
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018