#development #laravel #linux #php #sysadmin

Create a file:

/etc/systemd/system/schedule-mysite.service

Add the following content:

 1[Unit]
 2Description=Runs and keeps alive the artisan schedule:run process for www.mysite.com
 3
 4[Service]
 5Restart=always
 6WorkingDirectory=/var/www/www.mysite.com
 7ExecStart=/usr/bin/php artisan schedule:work --env=production
 8StandardOutput=append:/var/www/www.mysite.com/storage/logs/schedule.log
 9StandardError=append:/var/www/www.mysite.com/storage/logs/schedule.log
10
11[Install]
12WantedBy=default.target

To enable it:

$ systemctl enable schedule-mysite

To start it:

$ systemctl start schedule-mysite

To get the status:

$ systemctl status schedule-mysite