QnapFreeLCD icon indicating copy to clipboard operation
QnapFreeLCD copied to clipboard

Add script to install as daemon

Open jdupl opened this issue 11 years ago • 1 comments

Write a script to install a daemon in /etc/init.d to start the LCD at boot. Use start-stop-daemon for control over the daemon.

jdupl avatar Jan 14 '14 22:01 jdupl

Not a script to make it into a daemon, but here's a Systemd Service Unit that will start the script (as a daemon), any STDOUT/STDERR will go to syslog. The process can be enabled at boot time, started and stopped as any other system service.

I'd personally recommend changing the logging to write to STDOUT (so it goes into syslog, is rotated, etc). I also removed the ---- type lines from the log, and removed the timestamps from lines (since syslog puts it own on)

[Unit]
Description=QnapFreeLCD

[Service]
Type=simple
WorkingDirectory=/opt/QnapFreeLCD
ExecStart=/opt/QnapFreeLCD/lcd-control.ksh
Restart=on-failure
TimeoutStopSec=30

[Install]
WantedBy=multi-user.target

Put this file into /lib/systemd/system/lcd-control.service. You can start and stop it with systemctl start lcd-control or systemctl stop lcd-control. Enable at boot with systemctl enable lcd-control.

PS. Nice script - old as the hills now, but still does a decent job - thanks :-)

coofercat avatar Jul 30 '23 15:07 coofercat