summaryrefslogtreecommitdiff
blob: ea6363c71d136d3bb8f95234a2c0276e5eb385c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_commands="reload reconnect"

description_reload="Reload the config file"
description_reconnect="Force reconnection to an IRC server"

depend() {
	need net
}

start_pre() {
	if [ ! -f "${MYBOT}" ]; then
		eerror "${MYBOT} not found"
		return 1
	fi

	checkpath -d -o "${USER}":"${GROUP}" /var/run/iroffer-dinoex
	checkpath -d -o "${USER}":"${GROUP}" /var/log/iroffer-dinoex
	checkpath -d -o "${USER}":"${GROUP}" /var/lib/iroffer-dinoex
}

start() {
	ebegin "Starting iroffer-dinoex"
	start-stop-daemon --start --quiet  --pidfile "${PIDFILE}" --user "${USER}:${GROUP}" --exec "${BIN}" -- -b "${MYBOT}" -w "${STATE}" -s
	eend $?
}

stop() {
	ebegin "Stopping iroffer-dinoex"
	start-stop-daemon --stop --pidfile "${PIDFILE}" --exec "${BIN}"
	eend $?
}

reload(){
	ebegin "Reload iroffer-dinoex"
	start-stop-daemon --signal SIGUSR2 --pidfile "${PIDFILE}"
	eend $?
}

reconnect(){
	ebegin "Try to reconnect iroffer-dinoex to servers"
	start-stop-daemon --signal SIGUSR1 --pidfile "${PIDFILE}"
	eend $?
}