| 1 | #!/sbin/openrc-run |
| 2 | |
| 3 | daemon=/usr/bin/sircbot |
| 4 | sircbot_user=${sircbot_user:-sircbot} |
| 5 | sircbot_group=${sircbot_group:-sircbot} |
| 6 | pidfile=/var/run/sircbot/sircbot.pid |
| 7 | |
| 8 | depend() { |
| 9 | need net |
| 10 | after firewall |
| 11 | } |
| 12 | |
| 13 | checkconfig() { |
| 14 | if [ -z "$sircbot_channels" ]; then |
| 15 | eerror "Please specify sircbot_channels in /etc/conf.d/sircbot" |
| 16 | return 1 |
| 17 | fi |
| 18 | return 0 |
| 19 | } |
| 20 | |
| 21 | start() { |
| 22 | checkconfig || return 1 |
| 23 | checkpath --directory /var/run/sircbot --owner ${sircbot_user} |
| 24 | ebegin "Starting sircbot" |
| 25 | start-stop-daemon --start --user $sircbot_user --group $sircbot_group \ |
| 26 | --umask 0002 --pidfile "$pidfile" \ |
| 27 | --exec $daemon -- \ |
| 28 | $sircbot_opts \ |
| 29 | "${nickserv_pass:+-c \"nickserv :identify $nickserv_pass\"}" \ |
| 30 | $sircbot_channels |
| 31 | eend $? |
| 32 | } |
| 33 | |
| 34 | stop() { |
| 35 | ebegin "Stopping sircbot" |
| 36 | start-stop-daemon --stop --pidfile "$pidfile" --exec $daemon |
| 37 | eend $? |
| 38 | } |
| 39 | |