What is the correct way to restart OpenLiteSpeed from the command line?

mcbsys

New Member
#1
@Cold-Egg,

I'm running OpenLiteSpeed on two servers, one standalone (version 1.6.18) and one under CyberPanel (OLS version 1.6.19). I was looking up how to restart the web server and I remembered your post here.

Before systemd updates, we can mix up in use with "lswsctrl" and "systemctl" to restart lsws, but after the certain update, it messed up with systemctl. Like if you have a process start with lswsctrl start then systemctl restart/stop won't touch it.
I'm confused.

This OpenLiteSpeed documentation says to use lswsctrl restart.
This LiteSpeed documentation says to use service lsws restart. Would this differ from OpenLiteSpeed?
Your post above says to use systemctl restart lsws.

Which one is correct? Would it be possible to update the documentation if it is not correct?

Thanks,

Mark
 

gilles

Active Member
#3
If you're using systemctl / service to start lsws at boot, you have to keep using it (so that it keeps track of process ids properly).
If not, you can use lswsctrl directly.
 

mcbsys

New Member
#4
@gilles, it's good to know that principle, but I don't know how lsws starts at boot. My "pure" OpenLiteSpeed machine was pre-configured by @Cold-Egg as an Azure image. On my other machine, I started with Ubuntu 20.04 and installed CyberPanel from their one-line installer.

Does anyone know how lsws is configured in the various cases and how OpenLiteSpeed should be restarted?
 

Colcol

New Member
#5
@gilles thanks for the reply. Some amateur sleuthing (could be all wrong):

systemctl list-unit-files --type=service says lsws.service is 'generated'. The Debian manual explains 'generated' as "The unit file was generated dynamically via a generator tool. See systemd.generator(7). Generated unit files may not be enabled, they are enabled implicitly by their generator."

The link in the explanation says: "Generators are run very early at boot and cannot rely on any external services. They may not talk to any other process. That includes simple things such as logging to syslog(3), or systemd itself (this means: no systemctl(1))!"

Interpretation: lsws.service can't be started by systemctl at boot. Which I think means use /usr/local/lsws/bin/lswsctrl restart etc.
 

gilles

Active Member
#6
I'm running Ubuntu 20.04.2 LTS. Your system seems a bit different. The lsws service is definitely started on boot on my server node.
 

Colcol

New Member
#7
I'm running Debian 10.5 with OLS installed through the official video guide. LSWS service starts on boot and has been working fine. Just that my very amateur interpretation of the systemctl docs suggested LSWS is not started on boot by systemctl, but by something else. To be honest, I am way out of my depth here! I have not yet had a problem with the official OLS instruction of /usr/local/lsws/bin/lswsctrl restart, so I continue to use that and just hope everything keeps working.
 
Last edited:
Top