一、emqx开机自启
a.首先在执行如下命令
vi /lib/systemd/system/emqx.service
创建了emqx.service文件然后在文件中写入如下内容
\[Unit\]
Description=emqxautostart
After=network.target
\[Service\]
Type=forking
Environment=HOME=/opt/emqx
ExecStart=/opt/emqx/bin/emqx start
ExecReload=/opt/emqx/bin/emqx restart
ExecStop=/opt/emqx/bin/emqx stop
PrivateTmp=true
\[Install\]
WantedBy=multi-user.target
注意其中的
Environment=HOME=/opt/emqx
ExecStart=/opt/emqx/bin/emqx start
ExecReload=/opt/emqx/bin/emqx restart
ExecStop=/opt/emqx/bin/emqx stop
需要修改为自己的路径
保存退出后我的的服务已经好了接下来可以使用
systemctl start emqx.service
systemctl stop emqx.service
进行启动停止服务
我们还需要将服务添加到自启动那么需要执行如下
systemctl enable emqx.service
reboot试一下,会发现开机能够自启动
二、nginx开机自启
vim /lib/systemd/system/nginx.service
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
systemctl enable nginx.service
三、uwsgi开机自启
vim /lib/systemd/system/summary.service
[Unit]
Description=uWSGI instance to serve summary
After=network.target
[Service]
User=lufficc
Group=www-data
WorkingDirectory=/your/path/summary
Environment=FLASKR_SETTINGS=/your/path/summary/env.cfg
ExecStart=/usr/local/bin/uwsgi --ini //your/path/summary/uwsgi.ini
[Install]
WantedBy=multi-user.target
systemctl enable summary.service
手机扫一扫
移动阅读更方便
你可能感兴趣的文章