openlitespeed icon indicating copy to clipboard operation
openlitespeed copied to clipboard

disconnect between PIDFILE in lswsctrl and systemd service file

Open nobod33 opened this issue 10 months ago • 0 comments

Hello,

There seems to be "disconnect" between: https://github.com/litespeedtech/openlitespeed/blob/master/dist/admin/misc/lshttpd.service.inand https://github.com/litespeedtech/openlitespeed/blob/master/dist/bin/lswsctrl in relation to PIDFILE - service pointing to /var/run/openlitespeed.pid and lswsctl to /tmp/lshttpd/lshttpd.pid

As /tmp doesn't look like correct path to use for systemd service file(something what users might be willing to customize themselves) and thus mitigate it that way, lswsctl might need an update to reference same path?

With that mismatch , calling lswsctrl for restart fails to find correct service pid and basically no real restart happens.

# diff -u /usr/local/lsws/bin/lswsctrl /usr/local/lsws/bin/lswsctrl.1
--- /usr/local/lsws/bin/lswsctrl	2025-02-20 14:20:09.759479110 +0200
+++ /usr/local/lsws/bin/lswsctrl.1	2025-02-20 14:20:29.127591178 +0200
@@ -19,7 +19,7 @@
 
 # if the lsws_env is empty or not exist, still need to set the default values
 if [ "x$PIDFILE" = "x" ] ; then 
-    PIDFILE=/tmp/lshttpd/lshttpd.pid
+    PIDFILE=/var/run/openlitespeed.pid
     GRACEFUL_PIDFILE=/tmp/lshttpd/graceful.pid
 fi
 
# systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/litespeed.service.d
             └─override.conf
     Active: active (running) since Thu 2025-02-20 14:20:46 EET; 16min ago
    Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 2039199 (litespeed)
     CGroup: /system.slice/litespeed.service
             ├─2039199 "openlitespeed (lshttpd - main)"
             ├─2039200 "openlitespeed (lscgid)"
             ├─2039226 "openlitespeed (lshttpd - #01)"
             └─2039227 "openlitespeed (lshttpd - #02)"


# /usr/local/lsws/bin/lswsctrl restart
[OK] litespeed: pid=2040285.

# systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/litespeed.service.d
             └─override.conf
     Active: active (running) since Thu 2025-02-20 14:20:46 EET; 17min ago
    Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 2039199 (litespeed)
     CGroup: /system.slice/litespeed.service
             ├─2039199 "openlitespeed (lshttpd - main)"
             ├─2039200 "openlitespeed (lscgid)"
             ├─2039226 "openlitespeed (lshttpd - #01)"
             └─2039227 "openlitespeed (lshttpd - #02)"

# /usr/local/lsws/bin/lswsctrl.1 restart
[OK] Send SIGUSR1 to 2039199


 systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/litespeed.service.d
             └─override.conf
     Active: active (running) since Thu 2025-02-20 14:20:46 EET; 17min ago
    Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 2039199 (litespeed)
     CGroup: /system.slice/litespeed.service
             ├─2039199 "openlitespeed (lshttpd - main)"
             ├─2039200 "openlitespeed (lscgid)"
             ├─2039226 "openlitespeed (lshttpd - #01)"
             ├─2039227 "openlitespeed (lshttpd - #02)"
             ├─2040309 litespeed
             └─2040310 "openlitespeed (lscgid)"

# cat /usr/local/lsws/logs/lsrestart.log 
Thu Feb 20 02:37:37 PM EET 2025
restart, LSWS running: 0
Thu Feb 20 02:37:53 PM EET 2025
restart, LSWS running: 1

nobod33 avatar Feb 20 '25 12:02 nobod33