If you are adding a command boot of:
chmod +x /etc/rc.d/rc.local
The command writes to this file /etc/rc.d/rc.local
reboot
First, add the boot from Kai Services
Add in CentOS 7 in the boot from Kai service is very convenient, only two commands (to Jenkins for example):
$ systemctl enable jenkins.service #设置jenkins服务为自启动服务
$ sysstemctl start jenkins.service #启动jenkins服务
Second, add the boot from Kai Script
Increase in centos7 script There are two common methods to hexo-sever.sh an example script (script file):
bash #!/bin/bash cd /www/wwwroot/hexo nohup hexo s > test.log 2>&1 &
Specific examples of the operation (add a script from the start):
1, giving the script executable permissions (/www/wwwroot/hexo/hexo-sever.sh your script path)
$ chmod +x /www/wwwroot/hexo/hexo-sever.sh
2, open /etc/rc.d/rc.local or /etc/rc.local file, at the end the following additions
su - user -c '/www/wwwroot/hexo/hexo-sever.sh'
$ vim /etc/rc.local
$ su - user -c '/www/wwwroot/hexo/hexo-sever.sh'
3, in the centos7, / etc / rc.d / rc.local permissions are reduced, it is necessary to execute the following commands impart executable permissions
$ chmod +x /etc/rc.d/rc.local
Specific reference source text: https://www.tiance.club/post/2362243123.html