summaryrefslogtreecommitdiff
blob: ca475d66e56fd24e7536f1748630bcadaa1a1543 (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
52
53
54
55
56
57
58
59
#!/sbin/runscript

svc_name="AntiVir SAVAPI"

## required binaries
antivir_savapi_bin="/usr/lib/AntiVir/savapi"

## required config files
antivir_savapi_cfg="/etc/antivir-savapi.conf"

opts="${opts} reload"

depend() {
	need net
	use logger dns
}

checkconfig() {
	if [ ! -x "${antivir_savapi_bin}" ]; then
		eerror "SAVAPI binary [${antivir_savapi_bin}] missing"
		return 1
	fi
	if [ ! -r "${antivir_savapi_cfg}" ]; then
		eerror "SAVAPI config [${antivir_savapi_cfg}] missing"
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting ${svc_name}"
	"${antivir_savapi_bin}" --config="${antivir_savapi_cfg}" \
		--allow-remote-shutdown &>/dev/null
	eend $?
}

stop() {
	checkconfig || return 1
	ebegin "Stopping ${svc_name}"
	"${antivir_savapi_bin}" --config="${antivir_savapi_cfg}" \
		--stop &>/dev/null
	eend $?
}

reload() {
	checkconfig || return 1
	ebegin "Reloading ${svc_name}"
	"${antivir_savapi_bin}" --config="${antivir_savapi_cfg}" \
		--reload-engine --allow-remote-shutdown &>/dev/null
	eend $?
}

status() {
	checkconfig || return 1
	ebegin "Checking status of ${svc_name}"
	"${antivir_savapi_bin}" --config="${antivir_savapi_cfg}" \
		--status &>/dev/null
	eend $?
}