sircbot.initd 920 Bytes
Newer Older
1
#!/sbin/openrc-run
Natanael Copa's avatar
Natanael Copa committed
2 3 4 5 6 7 8 9 10 11 12

daemon=/usr/bin/sircbot
sircbot_user=${sircbot_user:-sircbot}
sircbot_group=${sircbot_group:-sircbot}
pidfile=/var/run/sircbot/sircbot.pid

depends() {
        need net
        after firewall
}

Natanael Copa's avatar
Natanael Copa committed
13
checkconfig() {
Natanael Copa's avatar
Natanael Copa committed
14 15 16 17 18 19 20 21 22
	if [ -z "$sircbot_channels" ]; then
		eerror "Please specify sircbot_channels in /etc/conf.d/sircbot"
		return 1
	fi
	return 0
}

start() {
	checkconfig || return 1
23
	checkpath --directory /var/run/sircbot --owner ${sircbot_user}
Natanael Copa's avatar
Natanael Copa committed
24 25 26
        ebegin "Starting sircbot"
        start-stop-daemon --start --user $sircbot_user --group $sircbot_group \
                --umask 0002 --pidfile "$pidfile" \
27 28 29 30
                --exec $daemon -- \
				$sircbot_opts \
				"${nickserv_pass:+-c "nickserv :identify $nickserv_pass"}" \
				$sircbot_channels
Natanael Copa's avatar
Natanael Copa committed
31 32 33 34 35 36 37 38 39
        eend $?
}

stop() {
        ebegin "Stopping sircbot"
        start-stop-daemon --stop --pidfile "$pidfile" --exec $daemon
        eend $?
}