/[gentoo-x86]/app-admin/webmin/files/init.d.webmin
Gentoo

Diff of /app-admin/webmin/files/init.d.webmin

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1.1.1 Revision 1.9
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2004 Gentoo Foundation 2# Copyright 1999-2011 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2 3# Distributed under the terms of the GNU General Public License v2
4# $Header: /var/cvsroot/gentoo-x86/app-admin/webmin/files/init.d.webmin,v 1.1.1.1 2005/11/30 09:59:51 chriswhite Exp $ 4# $Header: /var/cvsroot/gentoo-x86/app-admin/webmin/files/init.d.webmin,v 1.9 2011/12/31 18:33:40 idl0r Exp $
5
6
7# We do not give a choice to user for configuring these 'cause it will mess up
8# Webmin's configuration
9WEBMIN_EXE="%exe%"
10WEBMIN_PID="%pid%"
11WEBMIN_CONF="%conf%"
12
13extra_started_commands="reload"
5 14
6depend() { 15depend() {
7 use net logger 16 use net logger
8} 17}
9 18
19checkconfig() {
20 # Check if Webmin setup has been done
21 if [ ! -f /etc/webmin/config ]; then
22 eerror "Error in Webmin's configuration. The '/etc/webmin/config' is not present."
23 eerror "Please run 'emerge --config app-admin/webmin' to fix this."
24 return 1
25 fi
10 26
11checkconfig() { 27 # Check if ssl cert is present
12 if [ -f /etc/webmin/config ]; then 28 local key ssl
13 return 0; 29 key=`grep "^keyfile=" ${WEBMIN_CONF} | sed -e 's/keyfile=//g'`
30 ssl=`grep "^ssl=" ${WEBMIN_CONF} | sed -e 's/ssl=//g'`
31
32 if [ ! -f "${key}" ] ; then
33 if [ "${ssl}" = "0" ]; then
34 ewarn "Your SSL certificate is not present."
35 ewarn "Please either fix the path in the 'keyfile=' option of your ${WEBMIN_CONF}"
36 ewarn "OR run 'emerge --config app-admin/webmin'"
14 else 37 else
15 eerror "Error starting webmin. /etc/webmin/config is not present." 38 eerror "Error in Webmin's configuration. No SSL certificate is present."
16 eerror "Please report this on http://bugs.gentoo.org." 39 eerror "Please either fix the path in the 'keyfile=' option of your ${WEBMIN_CONF}"
40 eerror "OR change the 'ssl=' option of your ${WEBMIN_CONF} to 'ssl=0'"
41 eerror "OR run 'emerge --config app-admin/webmin'"
17 return 1; 42 return 1
43 fi
18 fi 44 fi
45
46 return 0
19} 47}
20 48
21start() { # copied from /etc/usermin/start 49reload() {
50 if [ ! -f "${WEBMIN_PID}" ]; then
51 eerror "Webmin is not running"
52 return 1
53 fi
54
55 checkconfig || return 1
56
57 ebegin "Reloading Webmin's configuration files"
58 start-stop-daemon --signal USR1 --pidfile "$WEBMIN_PID"
59 eend $?
60}
61
62start() {
22 checkconfig || return 1 63 checkconfig || return 1
23 ebegin "Starting Webmin" 64 ebegin "Starting Webmin"
24 65
25 LANG=
26 export LANG
27
28 unset PERLIO
29 export PERLIO
30 start-stop-daemon --start --quiet \ 66 start-stop-daemon --start --background --interpreted \
31 --exec /usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf 67 --env LANG= \
68 --env PERLLIB="%perllib%" \
69 --exec "$WEBMIN_EXE" \
70 --pidfile "$WEBMIN_PID" \
71 -- "$WEBMIN_CONF"
32 eend $? 72 eend $?
73 # Leave time to spawn, so no stop is received while spawning
74 sleep 3
33} 75}
34 76
35stop() { 77stop() {
36 ebegin "Stopping Webmin" 78 ebegin "Stopping Webmin"
37 start-stop-daemon --stop --pidfile /var/run/webmin.pid --quiet 79 start-stop-daemon --stop --interpreted --quiet \
80 --exec "$WEBMIN_EXE" \
81 --pidfile "$WEBMIN_PID"
38 eend $? 82 eend $?
83 # Leave time to stop because of the scripts that use this
84 sleep 3
39} 85}

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20