1#!/bin/sh
2# chkconfig: 235 99 10
3# description: web-based administration interface for Unix systems
4#
5### BEGIN INIT INFO
6# Provides:          webmin
7# Required-Start:    $local_fs $network $syslog
8# Required-Stop:     $local_fs $network
9# Default-Start:     2 3 4 5
10# Default-Stop:      0 1 6
11# Short-Description: web-based administration interface for Unix systems
12# Description:       Webmin is a web-based interface for system administration
13#                    for Unix. Using Webmin you can configure DNS, Samba, NFS,
14#                    local/remote filesystems and more using your web browser.
15### END INIT INFO
16
17PATH=/sbin:/usr/sbin:/bin:/usr/bin
18DESC="web-based administration interface for Unix systems"
19NAME=Webmin
20PIDFILE=/var/webmin/miniserv.pid
21SCRIPTNAME=/etc/init.d/$NAME
22START=/etc/webmin/start
23STOP=/etc/webmin/stop
24RELOAD=/etc/webmin/reload
25LOCKFILE=/var/lock/subsys/webmin
26CONFFILE=/etc/webmin/miniserv.conf
27
28case "$1" in
29start)
30	$START >/dev/null 2>&1 </dev/null
31	RETVAL=$?
32	if [ "$RETVAL" = "0" ]; then
33		touch $LOCKFILE >/dev/null 2>&1
34	fi
35	;;
36stop)
37	$STOP
38	RETVAL=$?
39	if [ "$RETVAL" = "0" ]; then
40		rm -f $LOCKFILE
41		pidfile=`grep "^pidfile=" $CONFFILE | sed -e 's/pidfile=//g'`
42		if [ "$pidfile" = "" ]; then
43			pidfile=$PIDFILE
44		fi
45		rm -f $pidfile
46	fi
47	;;
48status)
49	pidfile=`grep "^pidfile=" $CONFFILE | sed -e 's/pidfile=//g'`
50	if [ "$pidfile" = "" ]; then
51		pidfile=$PIDFILE
52	fi
53	if [ -s $pidfile ]; then
54		pid=`cat $pidfile`
55		kill -0 $pid >/dev/null 2>&1
56		if [ "$?" = "0" ]; then
57			echo "$NAME (pid $pid) is running"
58			RETVAL=0
59		else
60			echo "$NAME is stopped"
61			RETVAL=1
62		fi
63	else
64		echo "$NAME is stopped"
65		RETVAL=1
66	fi
67	;;
68restart)
69	$STOP ; $START
70	RETVAL=$?
71	;;
72reload|force-reload)
73	$RELOAD
74	RETVAL=$?
75	;;
76*)
77	echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
78	RETVAL=1
79	;;
80esac
81exit $RETVAL
82
83