linux添加开机启动项
ubuntu:
1.编写脚本xxx放于/etc/init.d/下
2.修改脚本执行权限:chmod 755 xxx
3.update-rc.d xxx defaults NN (NN为启动顺序),将脚本添加到系统启动执行的队列中去。
centos:
1.编写chkconfig格式的脚本xxx,放于/etc/init.d/下:
#/bin/sh #chkconfig: 2345 20 80 #description: nginx script,2345运行级 20是启动时优先级 80是关闭时优先级 case $1 in start) /usr/bin/nginx ;; stop) /usr/bin/nginx -s quit ;; *) echo "require start|stop" ;; esac
2.修改脚本执行权限:chmod 755 xxx
3.添加服务:chkconfig --add xxx
gentoo:
看下/etc/local.d/README这个文件,里面说的很清楚了
This directory should contain programs or scripts which are to be run
when the local service is started or stopped.
If a file in this directory is executable and it has a .start extension,
it will be run when the local service is started. If a file is
executable and it has a .stop extension, it will be run when the local
service is stopped.
All files are processed in lexical order.
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20