summaryrefslogtreecommitdiff
blob: 38ab1319df525d202e263b463143f70725bd26fb (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
48
49
50
51
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later

command="/usr/sbin/nullmailer-send"

start_stop_daemon_args="--chdir /var/spool/nullmailer --user nullmail:nullmail"
start_stop_daemon_args+=" --stdout /var/log/nullmailer/nullmailer.log"
start_stop_daemon_args+=" --stderr /var/log/nullmailer/nullmailer.log"

required_dirs="/var/spool/nullmailer /var/log/nullmailer"
pidfile="/run/nullmailer.pid"
command_background="true"

depend() {
	use net logger
}

checkconfig() {
	local error=0
	local f=/etc/nullmailer/me
	if [ ! -s ${f} ]; then
		eerror "${f} does not exist"
		error=1
	fi
	f=/etc/nullmailer/defaultdomain
	if [ ! -s ${f} ]; then
		eerror "${f} does not exist"
		error=1
	fi
	if [ ${error} -eq 1 ]; then
		einfo "You need to run 'emerge --config nullmailer'!"
	fi
	if [ -e /service/nullmailer ]; then
		eerror "Nullmailer is already running under svscan!"
		error=2
	fi
	if [ ${error} -ne 0 ]; then
		return 1
	else
		return 0
	fi
}

start_pre() {
	checkconfig
}

stop_pre() {
	checkconfig # to avoid init.d stopping svscan instance
}