CentOS7 startup script command running in the background

One,&

& Plus can run in the background after the Linux command

 

Two, nohup

SIGHUP signal to the immune, not immune to the SIGINT signal, available shopt | grep hup view.

When closing the terminal, shell by default will send SIGHUP signal to give the process associated with the terminal, causing other processes to follow the terminal exit. nohup captured SIGHUP, and do ignore the process, so the process does not exit.

Before Linux command with the nohup command corresponding process can continue to run after exiting accounts on / off terminal. The default will process all of the output is redirected to a file named nohup.out in.

Above in connection with them: nohup COMMAND &, so that we can make the order permanent executed in the background.

 

Three, rc.local

This file /etc/rc.d/rc.local added for compatibility purposes, it is recommended to create your own systemd service or udev rules, run the script instead of using this file during boot.

# Give the permission to execute commands in the file after the system starts
 chmod + the X-/etc/rc.d/rc.local

 

Guess you like

Origin www.cnblogs.com/jhxxb/p/10987503.html