summaryrefslogtreecommitdiff
path: root/sysutils/webmin/files/webmin.sh
blob: 7983b23bcce64d1498406561a95649aa9f0350ab (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: webmin.sh,v 1.1.1.1 2004/07/23 19:28:32 jlam Exp $
#
# PROVIDE: webmin
# REQUIRE: LOGIN

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

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

start_cmd="webmin_doit"
stop_cmd="webmin_doit"

webmin_doit()
{
	script="${webmin_etcdir}/${rc_arg}"
	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}
}

if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
	load_rc_config $name
	run_rc_command "$1"
else
	if [ -f /etc/rc.conf ]; then
		. /etc/rc.conf
	fi
	case "$1" in
	stop)
		eval ${stop_cmd}
		;;
	start)
		eval ${start_cmd}
		;;
	esac
fi