Add init script for systemd?
Closed this issue · 5 comments
Do you think adding a init script for systemd would be useful? Example:
File: ncam.service (/lib/systemd/system/ncam.service)
[Unit]
Description=NCam
After=network.target
[Service]
PIDFile=/var/run/ncam.pid
ExecStart=/usr/bin/ncam -c /etc/ncam -r 2 -b -B /var/run/ncam.pid
Type=forking
[Install]
WantedBy=multi-user.target
Depend on What image !
For example for dreamelite
[Unit]
Description=NCamxxx
Requires=emu-ncam.socket dev-dvb-adapter0-ca0.device dev-dvb-adapter0-demux0.device dev-sci0.device
After=dev-dvb-adapter0-ca0.device
After=dev-dvb-adapter0-demux0.device
After=dev-sci0.device
[Service]
Type=forking
ExecStart=/usr/bin/ncam -b -B -r 2 -w 1 -c /etc/tuxbox/config &
Restart=on-failure
NonBlocking=true
NotifyAccess=main
[Install]
WantedBy=multi-user.target
Also=emu-ncam.socket
Or Merlin4
[Unit]
Description=NCamxxxx
Requires=dev-dvb-adapter0-ca0.device dev-dvb-adapter0-demux0.device dev-sci0.device
After=dev-dvb-adapter0-ca0.device
After=dev-dvb-adapter0-demux0.device
After=dev-sci0.device
[Service]
Type=forking
ExecStart=/bin/sh -c '/usr/bin/cam/ncam -b -c /etc/tuxbox/config'
ExecStartPost=/bin/sh -c 'if ! /bin/grep -Fxq ncam /etc/clist.list ; then echo Ncam > /etc/clist.list ; fi'
ExecStopPost=/bin/sh -c 'echo none > /etc/clist.list'
NonBlocking=true
NotifyAccess=main
[Install]
WantedBy=multi-user.target
and .... etc
Ok, my example was for PC. Why not add specific files like
ncam.service.pc
ncam.service.merlin4
...
I have never use ncam on pc !
i do, because i have two reciever and a debian server already for nextcloud
My script for PC is the following:
[Unit]
Description=NCam
After=network.target
Requires=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/ncam -b -c /usr/local/etc/ncam -t /tmp/.ncam -B /var/run/ncam.pid -r 2
ExecStop=/bin/kill -s QUIT $MAINPID
ExecReload=/bin/kill -s SIGHUP $MAINPID
TimeoutStopSec=5
Restart=always
RestartSec=5
StartLimitInterval=0
[Install]
WantedBy=multi-user.target