开机启动服务
编写启动文件
cd /etc/systemd/system/
vim laravel-queue.service
填写服务内容
[Unit]
Description=Laravel Queue Worker
After=network.target
[Service]
User=your_username
Group=your_groupname
Restart=always
ExecStart=/usr/local/php8/bin/php /www/weisifang_com/artisan queue:work --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
启用并启动服务:
systemctl enable laravel-queue.service
systemctl start laravel-queue.service
其他命令
启动服务:systemctl start laravel-queue.service
停止服务:systemctl stop laravel-queue.service
重启服务:systemctl restart laravel-queue.service
查看服务状态:systemctl status laravel-queue.service
启用服务开机启动:systemctl enable laravel-queue.service
取消服务开机启动:systemctl disable laravel-queue.service