[Unit]
Description=The Swoole web Service
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/path/to/php console server --port 8080
ExecReload=/path/to/php console server --reload
ExecStop=/path/to/php console server --stop
User=root
Group=root
[Install]
WantedBy=multi-user.target
把上面的service放到文件中,比如:myservice.service, 然后移动到这个目录里/etc/systemd/system/
执行下面的命令把这个service加载到系统中,并设置开机启动
systemctl daemon-reload
systemctl start myservice.service
systemctl enable myservice.service