Linux scripts to automate (rc.local) when (CentOS) start

Here to talk about start-up carried out by the rc.local file

1, first create a startup script to start here as an example docker

Create a script docker-startup.sh

#! /bin/bash

/usr/bin/mk-docker-opts.sh -c
systemctl daemon-reload
systemctl restart docker

 

And execute permissions set to docker-startup.sh:

chmod +x docker-startup.sh

 

2, at the end of the script /etc/rc.local increase docker-startup.sh

Vim # / etc / rc.local 
# appended to the end to 
# / root / shell / Docker-the Startup. SH

 

And set the permissions to execute rc.local

chmod +x /etc/rc.local

 

3, restart, verify the results.

Guess you like

Origin www.cnblogs.com/linjiqin/p/11955794.html