reg service status

#1
Hi,

I am making some shell script to check openlitespeed status after installation.

I am using below cmd but somehow it's not working or helping.

systemctl show -p SubState lsws | sed 's/SubState=//g'
 

lsqtwrk

Administrator
#4
If LSWS/OLS was started by

/usr/local/lsws/bin/lswsctrl start

which is outside of systemd service control, in this case it will report as failed.

you need to make sure all your OLS command was done by `systemctl start/stop/restart lsws` and do not involve `/usr/local/lsws/bin/lswsctrl start/stop/restart`

you can do a check , logic as this :

if systemctl show -p SubState lsws | grep failed ; then
/usr/lcoal/lsws/bin/lswsctrl stop
systemctl stop lsws
systemctl start lsws
fi
 
#5
Actually I am doing some automation and need way to check service status at the end of script.

I do like this -

echo "FINAL SERVICE RUNNING STATUS"
echo " "
echo "Openlitespeed status -"#
### No cmd found

echo "ProFTPD status -"
systemctl show -p SubState proftpd | sed 's/SubState=//g'

echo "MariaDB status -"
systemctl show -p SubState mariadb | sed 's/SubState=//g'

Need solution to disply lsws service status like others.
 

lsqtwrk

Administrator
#6
Hi,

Just implement what I replied early

if it is failed , stop it via lswsctrl command and restart it by systemctl command ought do it.
 
#7
I made one script which install everything and at the end of script I would like to show final service status like running.

Anyway .. I try to manage it. Thank you .
 

lsqtwrk

Administrator
#8
Hi,

it's simple , just do like this


Code:
echo "FINAL SERVICE RUNNING STATUS"

echo " "

echo "Openlitespeed status -"#

/usr/local/lsws/bin/lswsctrl stop

systemctl stop lsws

systemctl start lsws

systemctl show -p SubState proftpd | sed 's/SubState=//g'
 
Top