File: tenshi.gentoo-init

package info (click to toggle)
tenshi 0.13-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 384 kB
  • sloc: perl: 1,812; sh: 302; makefile: 92
file content (48 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (6)
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
48
#!/sbin/runscript

opts="depend start stop reload flush checkconfig"

depend() {
	need clock hostname logger
}

checkconfig() {
	/usr/sbin/tenshi -C -c /etc/tenshi/tenshi.conf
	return $?
}

start() {
	ebegin "Starting tenshi"
	start-stop-daemon --start --quiet --exec /usr/sbin/tenshi -- -c /etc/tenshi/tenshi.conf -P /var/lib/tenshi/tenshi.pid
	eend $?
}

stop() {
	ebegin "Stopping tenshi"
	start-stop-daemon --stop --quiet --pidfile /var/lib/tenshi/tenshi.pid
	eend $?
}

reload() {
	if [ ! -f /var/lib/tenshi/tenshi.pid ]; then
		eerror "tenshi isn't running"
		return 1
	fi
	if checkconfig; then
		ebegin "Reloading configuration and flushing all queues"
		kill -HUP `cat /var/lib/tenshi/tenshi.pid` &>/dev/null
		eend $?
	else
		eerror "tenshi config file has syntax error, not restarting"
	fi
}

flush() {
	if [ ! -f /var/lib/tenshi/tenshi.pid ]; then
		eerror "tenshi isn't running"
		return 1
	fi
	ebegin "Flushing all queues"
	kill -USR2 `cat /var/lib/tenshi/tenshi.pid` &>/dev/null
	eend $?
}