Start openlitespeed 1.4 on system boot ?

#1
Hello,

I'm new to CentOS 7 's systemd, I'm trying to produce a perfect systemd service file for openlitespeed 1.4.11.

As Openlitespeed doenst' add a service file on installation I'm trying to make my own.

So far I have created :

Code:
[Unit]
Description=openlitespeed web server

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/lsws/bin/lswsctrl start
ExecReload=/usr/local/lsws/bin/lswsctrl reload
ExecRestart=/usr/local/lsws/bin/lswsctrl restart
ExecStop=/usr/local/lsws/bin/lswsctrl stop
ExecStatus=/usr/local/lsws/bin/lswsctrl status

[Install]
WantedBy=multi-user.target
Am I missing anything ?

mariab's one has things like

Code:
After=syslog.target
After=network.target
Not sure what that means though.

When I run systemctl is-active lsws

it says it's inactive, how do I tell systemd that the service is active ? Do I do it with ExecStartPost ?

Thanks
 

lsfoo

Administrator
#2
Hi Wanah,

Please try this and let us know if it works

Code:
[Unit]
Description=The Open LiteSpeed HTTP Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/tmp/lshttpd/lshttpd.pid
KillMode=none
PrivateTmp=false
... (ExecXXXX=...)

[Install]
WantedBy=multi-user.target
Alias=ols
Thanks,
Kevin
 
#3
Thanks,

With type=forking it didn't work but it does seem to work with simple mode :

Code:
[Unit]
Description=Openlitespeed web server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
PIDFile=/tmp/lshttpd/lshttpd.pid
KillMode=none
PrivateTmp=false
User=root
Group=root
ExecStart=/usr/local/lsws/bin/lswsctrl start
ExecReload=/usr/local/lsws/bin/lswsctrl reload
ExecRestart=/usr/local/lsws/bin/lswsctrl restart
ExecStop=/usr/local/lsws/bin/lswsctrl stop
ExecStatus=/usr/local/lsws/bin/lswsctrl status

[Install]
WantedBy=multi-user.target
Alias=ols
When I tried with Type=forking it gave errors like :

Code:
systemd[1]: [/usr/lib/systemd/system/lsws.service:8] Unknown lvalue 'ExecRestart' in section 'Service'
systemd[1]: [/usr/lib/systemd/system/lsws.service:10] Unknown lvalue 'ExecStatus' in section 'Service'
With Type=simple status now works

Code:
systemctl status lsws
lsws.service - Openlitespeed web server
   Loaded: loaded (/usr/lib/systemd/system/lsws.service; enabled)
   Active: active (running) since Mon 2015-07-27 13:33:13 UTC; 4min 24s ago
  Process: 4358 ExecStop=/usr/local/lsws/bin/lswsctrl stop (code=exited, status=0/SUCCESS)
  Process: 4437 ExecReload=/usr/local/lsws/bin/lswsctrl reload (code=exited, status=0/SUCCESS)
Main PID: 4452 (litespeed)
   CGroup: /system.slice/lsws.service
           ├─4452 openlitespeed (lshttpd - main)
           ├─4459 openlitespeed (lscgid)
           ├─4472 openlitespeed (lshttpd - #01)
           ├─4473 openlitespeed (lshttpd - #02)
           ├─4474 lsphp5
           └─4475 lsphp
Does this look correct to you ? not sure what the difference between simple and forking is though…
 

lsfoo

Administrator
#4
Hi wanah,

As long as the server works, it is fine.

However, if you do run into any problems, don't hesitate to ask!

Best,
Kevin
 
Top