亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Webman框架實現在linux上開機自啟動和服務管理

標簽:
PHP 運維

php-webman高性能框架在linux上实现服务管理以及自启动配置

在linux搭建完项目以后,通过在【etc/systemd/system】目录编写【.service】文件来进行管理,添加完以后可以使用【systemct | status | restart | start | stop php-webman.service】命令来进行管理

第一步

在【etc/systemd/system】目录里面创建【php-webman.service】文件,文件内容如下:

[Unit]
Description=TPSP Exam Service

[Service]
# 使用哪个用户进行启动
User=apache
Group=apache
# 工作目录
WorkingDirectory=/data/app/tpsp-exam-service
# 环境变量,没有需要加载的环境变量可以不写这一行
EnvironmentFile=/data/app/tpsp.env
Type=forking
# 这里一定要写pid的文件位置,不然没法进行管理,实验多次了!!!
PIDFile=/data/app/tpsp-exam-service/tpsp-exam-service/runtime/webman.pid
# 启动时执行的命令:systemctl start php-webman.service
ExecStart=/data/app/tpsp-exam-service/tpsp-exam-service/start.php start -d
# 停止时执行的命令:systemctl stop php-webman.service
ExecStop=/data/app/tpsp-exam-service/tpsp-exam-service/start.php stop
Restart=on-failure
RestartSec=60

[Install]
WantedBy=multi-user.target

第二步:配置开机启动

重新加载systemd的守护进程配置

# 设置开机自启动
systemctl enable php-webman.service
# 使配置生效
systemctl daemon-reload

按照上面的步骤配置完以后,就可以通过【systemct | status | restart | start | stop php-webman.service】命令来管理webman服务了

點擊查看更多內容
1人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消