#!/bin/bash
### BEGIN INIT INFO
# Provides: znc
# Required-Start: $local_fs $syslog $network
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start ZNC at boot time
# Description: Enable ZNC provided by /etc/init.d/znc.
### END INIT INFO
PID=`pidof znc`
case "$1" in
start)
if [[ $PID != "" ]]; then
echo "ZNC is already running"
exit 1
else
echo "Starting ZNC"
sudo -u ubuntu znc > /dev/null 2>&1
fi
;;
stop)
if [[ $PID != "" ]]; then
echo "Stopping ZNC"
kill -9 $PID > /dev/null 2>&1
else
echo "ZNC is not running"
exit 1
fi
;;
restart|reload)
if [[ $PID != '' ]]; then
echo "Stopping ZNC"
kill -9 $PID > /dev/null 2>&1
echo "Starting ZNC"
sudo -u ubuntu znc > /dev/null 2>&1
else
echo "ZNC is not running"
exit 1
fi
;;
status)
if [[ $PID != "" ]]; then
echo "ZNC is running"
else
echo "ZNC is not running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac
chmod +x /etc/init.d/znc
Then to add it to your runlevels run:
sudo update-rc.d znc defaults
Edit:
Apparently I should have read the docs. In the ZNC wiki are instructions for doing this. Ah well...
http://wiki.znc.in/Running_ZNC_as_a_system_daemon
Safehands Security Services is one stop shop for providing all kinds of security services in and around Adelaide, Australia. Our security guards are well experienced in providing Private Party Securities. Our security officers can watch the gate, escort the guests and celebrities, help in parking vehicles, secure the periphery, monitor electronic security systems, keep the gatecrashers at the bay, protect your assets, and also they even help you with your party arrangements without much ado. Your peace of mind is just a call away.
ReplyDeleteHire Security Guards | Security Guards Companies | Security Guards Services | Security Services Australia | Security Companies Australia | Event Security Services | Private Party Security | K9 Security Services | Mobile Patorls & Alarm Response Service | Crowd Control Services | Security Guards Agencies | Security Companies | Security Services | Security Agencies | Security Guards Services