openlitespeed icon indicating copy to clipboard operation
openlitespeed copied to clipboard

OpenLiteSpeed starts unconditionally on upgrade

Open richarson opened this issue 1 year ago • 6 comments

Hi!

We're using OLS in some of our cloud servers and we give our customers the choice to use it instead o Apache, which means that the web server not in use is masked via systemctl.

My problem is that, upon upgrading OLS via yum it starts unconditionally, regardless of if it was running or Apache was, which generates conflicts as it tries to bind to ports 80 and 443.

Is there a way to stop this behaviour? Is it a packaging issue? (We're using the oficial repos from LiteSpeed Tech).

Thanks in advance.

richarson avatar Apr 29 '24 22:04 richarson

Bump?

richarson avatar Apr 24 '25 16:04 richarson

According to rpm -qp --scripts openlitespeed-1.7.19-5.el7.x86_64.rpm this is the code that should be modified in the spec, which I can't find in this repo:

posttrans scriptlet (using /bin/sh):
if [[ -e /etc/systemd/system ]] || [[ -e /usr/lib/systemd/system ]] || [[ -e /lib/systemd/system ]] ; then
  systemctl status lsws > /dev/null 2>&1
  if [[ $? = 3 ]] ; then
    /usr/local/lsws/bin/lswsctrl stop > /dev/null 2>&1
  fi
  systemctl restart lsws > /dev/null 2>&1
else
  service lsws restart >/dev/null 2>&1 || :
fi

It should simply use condrestart, like so:

posttrans scriptlet (using /bin/sh):
if [[ -e /etc/systemd/system ]] || [[ -e /usr/lib/systemd/system ]] || [[ -e /lib/systemd/system ]] ; then
  systemctl condrestart lsws > /dev/null 2>&1
else
  service lsws condrestart >/dev/null 2>&1 || :
fi

richarson avatar Aug 08 '25 18:08 richarson

Thanks. updated.

litespeedtech avatar Aug 08 '25 22:08 litespeedtech

But, I think it wont start LSWS for a new installation.

litespeedtech avatar Aug 08 '25 22:08 litespeedtech

Updated it to

if [[ -e /etc/systemd/system ]] || [[ -e /usr/lib/systemd/system ]] || [[ -e /lib/systemd/system ]] ; then
  if [ "$1" -eq 1 ]; then
    systemctl start lsws > /dev/null 2>&1
  else
    systemctl condrestart lsws > /dev/null 2>&1
  fi
else
  if [ "$1" -eq 1 ]; then
    service lsws restart >/dev/null 2>&1 || :
  else
    service lsws condrestart >/dev/null 2>&1 || :
  fi
fi

it should try to bring up OLS for new installation.

litespeedtech avatar Aug 09 '25 17:08 litespeedtech

Thanks!

richarson avatar Aug 11 '25 23:08 richarson