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.
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.phpStart command: php server.php startIt 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
To modify this file, you must restart the server, otherwise it will not take effect
Step 3: Start the service
systemctl start workerman.service
Step 4: Check the service status
systemctl status workerman.service
Step 5: Boot up
systemctl enable workerman.service
The workerman.service service file was modified without restarting the serverFor 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!