安装完webman并设置开机自启却不成功

glennfrey

问题描述

运行环境:Centos7.9 + Php8.1
安装完webman并设置开机自启(配置文件/etc/systemd/system/webman.service)不成功
[Unit]
Description=webman
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/bin/php /home/wwwroot/www.giles.pub/start.php start -d
ExecReload=/usr/local/bin/php /home/wwwroot/www.giles.pub/start.php restart
ExecStop=/usr/local/bin/php /home/wwwroot/www.giles.pub/start.php stop
PrivateTmp=true
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

为此你搜索到了哪些方案及不适用的原因

查看了下状态,自启不成功

sudo systemctl status webman.service

● webman.service - webman
Loaded: loaded (/etc/systemd/system/webman.service; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2025-04-14 10:57:49 CST; 11min ago
Process: 696 ExecStart=/usr/local/bin/php /home/wwwroot/www.giles.pub/start.php start -d (code=exited, status=0/SUCCESS)
Main PID: 696 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/webman.service
├─1053 WorkerMan: master process start_file=/home/wwwroot/www.giles.pub/start.php
├─1058 WorkerMan: worker process webman http://0.0.0.0:8787
├─1059 WorkerMan: worker process webman http://0.0.0.0:8787
├─1060 WorkerMan: worker process webman http://0.0.0.0:8787
├─1061 WorkerMan: worker process webman http://0.0.0.0:8787
└─1062 WorkerMan: worker process monitor none

显示一开启就退出?active (exited)

188 1 0
1个回答

nitron

有没有使用systemctl enable启用

  • glennfrey 7天前

    webman.service 是 enabled 过的

  • glennfrey 7天前

    composer create-project --prefer-dist workerman/webman:~2.0 www.giles.pub
    上面是项目创建命令,是不是webman版本的问题?

  • nitron 7天前

    journalctl -u webman 看下日志吧

  • glennfrey 7天前

    journalctl -u webman

    -- Logs begin at Mon 2025-04-14 11:45:57 CST, end at Mon 2025-04-14 11:46:35 CST. --
    Apr 14 11:46:05 czwox6jsdqmmljde systemd[1]: Started webman.

  • nitron 7天前

    就1条日志?

  • glennfrey 7天前

    重启后就这一条日志

  • glennfrey 7天前

    但是把8787端口开放后,http://182.43.183.206:8787/ 是可以访问到页面的

  • glennfrey 7天前

    sudo systemctl status webman.service

    ● webman.service - webman
    Loaded: loaded (/etc/systemd/system/webman.service; enabled; vendor preset: disabled)
    Active: active (exited) since Mon 2025-04-14 11:46:05 CST; 7min ago
    Process: 691 ExecStart=/usr/local/bin/php /home/wwwroot/www.giles.pub/start.php start -d (code=exited, status=0/SUCCESS)
    Main PID: 691 (code=exited, status=0/SUCCESS)

  • nitron 7天前

    把Type=forking改为Type=exec或者去掉Type那一列

  • glennfrey 7天前

    如上图,Active: inactive (dead)

  • nitron 7天前

    仔细看你没配置PID路径,之前配置不用改,[Service]块加一行,

    PIDFile=/home/wwwroot/www.giles.pub/runtime/webman.pid
  • glennfrey 7天前

    果然可以了,多谢

×
🔝