Home > PHP Framework > Workerman > How to set workerman to start automatically after booting up (linux environment)

How to set workerman to start automatically after booting up (linux environment)

青灯夜游
Release: 2021-02-01 12:02:10
forward
3954 people have browsed it

This article will introduce to you the method of workerman setting up automatic startup on boot under Linux system. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to set workerman to start automatically after booting up (linux environment)

Related recommendations: "workerman Tutorial"

Step 1: Create the worker.service service file (Permission 755)

/lib/systemd/system/workerman.service

Step 2 : Copy the following code, save and exit. Pay attention to modify your worker path

## Path: /www/wwwroot/xxx.com/server.php

Start command: php server.php start

It can be started in the above command, the path is as follows

[Unit]
Description=workerman
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/php /xxx/xxx/server.php start -d
ExecReload=/usr/bin/php /xxx/xxx/server.php restart
ExecStop=/usr/bin/php /xxx/xxx/server.php stop
PrivateTmp=true
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Copy after login

To modify this file, you must restart the server, otherwise it will not take effect

Step 3: Start the service

systemctl start workerman.service
Copy after login

Step 4: Check the service status

systemctl status workerman.service
Copy after login

Step 5: Boot up

systemctl enable workerman.service
Copy after login

Note:


The pagoda does not work here. After the above is generated, a task will be generated here. Do not operate it

Error:

The unit file, source configuration file or drop-ins of workerman.service changed on disk. Run 'systemctl daemon-reload' to reload units

The workerman.service service file was modified without restarting the server

For more programming-related knowledge, please visit:

Introduction to Programming! !

The above is the detailed content of How to set workerman to start automatically after booting up (linux environment). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template