内容简介:假设启动脚本为:/usr/local/ngx_openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf第一种方式:传统的/etc/init.d/下面的脚本新建脚本文件start.sh
假设启动脚本为:/usr/local/ngx_openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf
第一种方式:传统的/etc/init.d/下面的脚本
新建脚本文件start.sh
#!/bin/bash /usr/local/ngx_openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf exit 0
设置权限
sudo chmod 755 start.sh
链接到启动目录下
sudo ln pwd
/start.sh -s /etc/init.d/
添加到启动项目
cd /etc/init.d/
99为优先级,越高越晚执行。。。
sudo update-rc.d start.sh defaults 99
移除开机启动项
sudo update-rc.d -f start.sh remove
第二种方式:systemd
[Unit] Description=The NGINX HTTP and reverse proxy server [Service] Type=forking ExecStartPre=/usr/local/ngx_openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf -t ExecStart=//usr/local/ngx_openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
重启配置列表
systemctl daemon-reload
启动命令为
service nginx start
systemctl start nginx
systemctl start nginx.service
这个是列举所有已经存在配置文件对应的服务状态列表
systemctl list-unit-files | grep nginx
列举出具有加载状态的服务列表
systemctl --all | grep nginx
常用命令:
systemctl start nginx
systemctl start nginx.service
systemctl stop nginx
systemctl reload nginx
systemctl restart nginx
systemctl status nginx
添加为开机启动:
systemctl enable nginx.service
systemctl enable nginx
移除开机启动:
systemctl disable nginx.service
systemctl disable nginx
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
C程序设计语言
(美)Brian W. Kernighan、(美)Dennis M. Ritchie / 徐宝文、李志译、尤晋元审校 / 机械工业出版社 / 2004-1 / 30.00元
在计算机发展的历史上,没有哪一种程序设计语言像C语言这样应用广泛。本书原著即为C语言的设计者之一Dennis M.Ritchie和著名计算机科学家Brian W.Kernighan合著的一本介绍C语言的权威经典著作。我们现在见到的大量论述C语言程序设计的教材和专著均以此书为蓝本。原著第1版中介绍的C语言成为后来广泛使用的C语言版本——标准C的基础。人们熟知的“hello,World"程序就是由本书......一起来看看 《C程序设计语言》 这本书的介绍吧!