1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

logs document logrotate configuration for lwsws

After discussion here

https://libwebsockets.org/pipermail/libwebsockets/2016-April/002304.html

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-04-26 19:07:17 +08:00
parent 12aeba73c0
commit 734f10a19b
3 changed files with 67 additions and 0 deletions

View file

@ -310,3 +310,49 @@ And map the provided HTML into the vhost in the mounts section
You might choose to put it on its own vhost which has "interface": "lo", so it's not
externally visible.
Integration with Systemd
------------------------
lwsws needs a service file like this as `/usr/lib/systemd/system/lwsws.service`
```
[Unit]
Description=Libwebsockets Web Server
After=syslog.target
[Service]
ExecStart=/usr/local/bin/lwsws
StandardError=null
[Install]
WantedBy=multi-user.target
```
You can find this prepared in `./lwsws/usr-lib-systemd-system-lwsws.service`
Integration with logrotate
--------------------------
For correct operation with logrotate, `/etc/logrotate.d/lwsws` (if that's
where we're putting the logs) should contain
```
/var/log/lwsws/*log {
copytruncate
missingok
notifempty
delaycompress
}
```
You can find this prepared in `/lwsws/etc-logrotate.d-lwsws`
Prepare the log directory like this
```
sudo mkdir /var/log/lwsws
sudo chmod 700 /var/log/lwsws
```

View file

@ -0,0 +1,10 @@
/var/log/lwsws/*log {
copytruncate
missingok
notifempty
delaycompress
postrotate
/bin/systemctl reload lwsws.service > /dev/null 2>/dev/null || true
endscript
}

View file

@ -0,0 +1,11 @@
[Unit]
Description=Libwebsockets Web Server
After=syslog.target
[Service]
ExecStart=/usr/local/bin/lwsws
StandardError=null
[Install]
WantedBy=multi-user.target