[alibaba/tengine]功能请求:开机自启

2024-05-15 697 views
9
Why you need it?

怎么才能方便地开机自启呢?

How it could be? Other related information

回答

0

@JornShen 我复制一份nginx的systemd脚本试试吧

2

脚本 /etc/systemd/system/tengine.service

[Unit] Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target

[Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid # Nginx will fail to start if /run/nginx.pid already exists but has the wrong # SELinux context. This might happen when running ‘nginx -t’ from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 ExecStartPre=/usr/bin/rm -f /usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true

[Install] WantedBy=multi-user.target

大伙帮忙看看,这个代码有没有毛病呀?

4

试了一下 好像还能用 决定先用着 哈哈