summaryrefslogtreecommitdiff
path: root/sysutils/webmin/files/webmin.sh
blob: 423cb9f455d946c7bba8164f88b4b06bec4516a6 (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: webmin.sh,v 1.4 2012/11/02 19:02:51 shattered Exp $
#

# PROVIDE: webmin
# REQUIRE: LOGIN

. /etc/rc.subr

name="webmin"
rcvar=${name}
command="@WEBMIN_DIR@/miniserv.pl"
command_interpreter="@PERL5@"
webmin_etcdir="@PKG_SYSCONFDIR@"
required_files="@PKG_SYSCONFDIR@/miniserv.conf"
extra_commands="reload"

reload_cmd="webmin_doit reload"
restart_cmd="webmin_doit restart"
start_cmd="webmin_doit start"
stop_cmd="webmin_doit stop"

webmin_doit()
{
	case "$1" in
	reload|restart|start|stop)	;;
	*)				return 1 ;;
	esac
	script="${webmin_etcdir}/$1"
	required_files="$required_files $script"
	for f in $required_files; do
		if [ ! -r "$f" ]; then
			echo 1>&2 "$0: WARNING: $f is not readable"
			if [ -z $rc_force ]; then
				return 1
			fi
		fi
	done
	$script
}

load_rc_config $name
run_rc_command "$1"