Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

配置成 systemd 服务 #41

Open
ghost opened this issue Mar 29, 2017 · 0 comments
Open

配置成 systemd 服务 #41

ghost opened this issue Mar 29, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 29, 2017

保存 service 配置文件,注意修改 User、Group,PIDFile 与 php、artisan 绝对路径。

cat << "EOF" | sudo tee /lib/systemd/system/laravoole.service
[Unit]
Description=Laravoole
After=network.target

[Service]
User=nobody
Group=nogroup
LimitCORE=infinity
LimitNOFILE=262140
LimitNPROC=262140
Type=forking
PIDFile=/dev/shm/laravoole.pid
ExecStart=/usr/local/bin/php /xxx/artisan laravoole start
ExecReload=/usr/local/bin/php /xxx/artisan laravoole reload
ExecStop=/usr/local/bin/php /xxx/artisan laravoole stop
Restart=on-failure
RestartSec=3s

[Install]
WantedBy=multi-user.target
EOF

然后执行

systemctl daemon-reload
systemctl enable laravoole
systemctl restart laravoole

配置成了开机启动,并且如果进程意外退出,系统会重新拉起。
手动重启可以使用 systemctl 或 service 命令。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants