Restarting the main
lsws
service does not restart the lsphp
processes it spawns, as one might expect, and the wiki only mentions a command to do so, as if invoked manually. It's quite important to do this after system updates, and easy to automate with systemd:- Create a service definition named
/usr/local/lib/systemd/system/lsphp-detached-restart@.service
and set its contents as below, adjusting thetouch
ed path to match your server's$VH_ROOT
prefix:
INI:[Unit] Description=Ensure detached lsphp services restart with lsws PartOf=lsws.service [Service] Type=oneshot RemainAfterExit=yes UMask=0333 ExecStart=/bin/true ExecStop=/bin/touch /var/www/%i/.lsphp_restart.txt [Install] WantedBy=lsws.service
- The
%i
in the file is replaced by the service instance name, so you can enable the service for each vhost user:
Bash:systemctl enable --now lsphp-detached-restart@user1.service lsphp-detached-restart@user2.service
lsws
service, so it will start, restart and stop in sync with that. The true
is just a successful no-op to let the service start. However, when it stops, it marks the detached php processes as outdated. I chose to do it on stop to try to avoid race conditions during the main service startup.