Boot The script to start qidong.sh[root@c69-01 scripts]# vim/server/scripts/qidong.sh[root@c69-01 scripts]# cat/server/scripts/qidong.sh#!/bin/bash/ Bin/echo $ (/bin/date +%f_%t) >>/tmp/qidong.log
method One: Modify/etc/rc.local
/etc/rc.local, this file is a linked file [root@c69-01 ~]# ll/etc/rc.local lrwxrwxrwx. 1 root Feb 5 10:03/etc/rc.local-> rc.d/rc.local
Modify/etc/rc.local file [root@c69-01 scripts]# tail-n 1/etc/rc.local/bin/bash/server/scripts/qidong.sh >/dev/null 2> /dev/null
Reboot the system and view the results [root@c69-01 ~]# cat/tmp/qidong.log 2018-02-19_23:30:56
Boot from boot This script Method II: Chkconfig Management
Remove the configuration of the method one [root@c69-01 ~]# vim/etc/init.d/test #!/bin/bash# chkconfig:3-a 88/bin/bash/server/scripts/qidong.sh Ev/null 2>/dev/null [root@c69-01 ~]# chmod +x/etc/init.d/test
Add to Chkconfig, boot from [root@c69-01 ~]# chkconfig--add test[root@c69-01 ~]# chkconfig--list testtest 0:off 1:off 2: Off 3:on 4:off 5:off 6:off
Reboot the system and view the results [root@c69-01 ~]# cat/tmp/qidong.log 2018-02-19_23:30:562018-02-19_23:59:10
Operation successful
Turn off boot start [root@c69-01 ~]# chkconfig test off[root@c69-01 ~]# chkconfig--list testtest 0:off 1:off 2:off 3:off 4:o FF 5:off 6:off
Remove test from Chkconfig administration [root@c69-01 ~]# chkconfig--list testtest 0:off 1:off 2:off 3:off 4:off 5:off 6:off[root@c6 9-01 ~]# chkconfig--del test[root@c69-01 ~]# chkconfig--list testservice test supports chkconfig, but is not referenced In any runlevel (run ' chkconfig--add test ')
The above 2 kinds of boot from the start Script method, for reference only, the reader may according to own situation, carries on the configuration.
Note: The system I am using is CentOS Release 6.9 (Final)
This article is reproduced from: https://www.linuxprobe.com/linux-open-sh.html