aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openvas-scanner/openvassd.initd
blob: 560141d74f867cbd0f66af5815be88afc4781251 (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
#!/sbin/openrc-run
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: 

depend() {
	need net
}

sanity_test() {
	if [ -z "${OPENVAS_USER}" ] ; then
		eerror "OPENVAS_USER is empty"
		return 1
	fi
	if [ $OPENVAS_USER != 'root' ] ; then
		chown -R $OPENVAS_USER:$OPENVAS_GROUP /var/cache/openvas/ /var/lib/openvas/ /var/log/openvas/
		chgrp -R $OPENVAS_USER /etc/openvas/ /var/lib/openvas/ /usr/share/openvas/openvasmd/global_report_formats/
		chmod -R g+rX /etc/openvas/ /var/lib/openvas/
	fi
}

start() {
	ebegin "Starting openvassd (scanner) as user ${OPENVAS_USER}"
	sanity_test || return 1
	#for using sbin tools when running as non root
	export PATH="$PATH:/sbin:/usr/sbin"
	start-stop-daemon --start --name openvassd --user "${OPENVAS_USER}" --exec /usr/bin/openvassd \
		--pidfile /var/run/openvassd.pid
	eend $? 
}

stop() {
	ebegin "Stop openvassd (scanner)"
	start-stop-daemon --stop --name openvassd \
		--pidfile /var/run/openvassd.pid
	eend $?
}