aboutsummaryrefslogtreecommitdiffstats
path: root/community/openvas-scanner/openvas-nvt-sync.cron
blob: ff1729f9f80a56ff73c8458cf94a7f0597d52567 (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
#!/bin/sh

if [ -f /etc/openvas/openvassd.conf ]; then
	. /etc/openvas/openvassd.conf
fi

if [ "$auto_plugin_update" != "yes" ]; then
	exit 0
fi

opts=""
case "$update_method" in
	rsync)
		opts = "$opts --rsync"
		;;
	wget)
		opts = "$opts --wget"
		;;
	curl)
		opts = "$opts --curl"
		;;
esac

# Export openvas-nvt-sync's environment variables if they are defined
[ \! -z "$NVT_DIR" ] && export NVT_DIR
[ \! -z "$OV_RSYNC_FEED" ] && export OV_RSYNC_FEED
[ \! -z "$OV_HTTP_FEED" ] && export OV_HTTP_FEED

/usr/sbin/openvas-nvt-sync $opts >& /dev/null

if [ $? -ne 0 ]; then
	echo "Error updating OpenVAS plugins. Please run openvas-nvt-sync manually."
	exit 1
fi

if [ "$notify_openvas_scanner" == "yes" ]; then
	/etc/init.d/openvas-scanner reloadplugins
fi