[1396] | 1 | --- /dev/null 2009-12-25 01:17:35.868011025 -0500 |
---|
| 2 | +++ moira-update-server.init 2009-12-26 22:31:51.000000000 -0500 |
---|
| 3 | @@ -0,0 +1,128 @@ |
---|
| 4 | +#! /bin/sh |
---|
| 5 | +# Stolen from Debathena |
---|
| 6 | + |
---|
| 7 | +### BEGIN INIT INFO |
---|
| 8 | +# Provides: moira-update-server |
---|
| 9 | +# Required-Start: $local_fs $remote_fs |
---|
| 10 | +# Required-Stop: $local_fs $remote_fs |
---|
| 11 | +# Default-Start: 2 3 4 5 |
---|
| 12 | +# Default-Stop: 0 1 6 |
---|
| 13 | +# Short-Description: Moira update_server |
---|
| 14 | +# Description: The moira update_server program for taking updates from |
---|
| 15 | +# moira |
---|
| 16 | +### END INIT INFO |
---|
| 17 | + |
---|
| 18 | +# Original Author: Evan Broder <broder@mit.edu> |
---|
| 19 | +# Modified for Fedora by Greg Brockman <gdb@mit.edu> |
---|
| 20 | + |
---|
| 21 | +# Do NOT "set -e" |
---|
| 22 | + |
---|
| 23 | +# PATH should only include /usr/* if it runs after the mountnfs.sh script |
---|
| 24 | + |
---|
| 25 | +prog=update_server |
---|
| 26 | +exec=/usr/sbin/update_server |
---|
| 27 | +config=/etc/athena/moira.conf |
---|
| 28 | + |
---|
| 29 | +# From Debathena |
---|
| 30 | +PATH=/usr/sbin:/usr/bin:/sbin:/bin |
---|
| 31 | +DESC="Moira update_server" |
---|
| 32 | +DAEMON_ARGS="" |
---|
| 33 | +SCRIPTNAME=/etc/rc.d/init.d/$NAME |
---|
| 34 | + |
---|
| 35 | +# Exit if the package is not installed |
---|
| 36 | +[ -x "$exec" ] || exit 0 |
---|
| 37 | + |
---|
| 38 | +# Read configuration variable file if it is present |
---|
| 39 | +[ -r /etc/default/$prog ] && . /etc/default/$prog |
---|
| 40 | + |
---|
| 41 | +# Load the VERBOSE setting and other rcS variables |
---|
| 42 | +[ -f /etc/default/rcS ] && . /etc/default/rcS |
---|
| 43 | + |
---|
| 44 | +# Define LSB log_* functions. |
---|
| 45 | +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. |
---|
| 46 | +. /lib/lsb/init-functions |
---|
| 47 | +# End from Debathena |
---|
| 48 | + |
---|
| 49 | +# Source function library. |
---|
| 50 | +. /etc/rc.d/init.d/functions |
---|
| 51 | + |
---|
| 52 | +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog |
---|
| 53 | + |
---|
| 54 | +lockfile=/var/lock/subsys/$prog |
---|
| 55 | + |
---|
| 56 | +start() { |
---|
| 57 | + [ -x $exec ] || exit 5 |
---|
| 58 | + [ -f $config ] || exit 6 |
---|
| 59 | + echo -n $"Starting $prog: " |
---|
| 60 | + # if not running, start it up here, usually something like "daemon $exec" |
---|
| 61 | + daemon $exec |
---|
| 62 | + retval=$? |
---|
| 63 | + echo |
---|
| 64 | + [ $retval -eq 0 ] && touch $lockfile |
---|
| 65 | + return $retval |
---|
| 66 | +} |
---|
| 67 | + |
---|
| 68 | +stop() { |
---|
| 69 | + echo -n $"Stopping $prog: " |
---|
| 70 | + # stop it here, often "killproc $prog" |
---|
| 71 | + killproc $prog |
---|
| 72 | + retval=$? |
---|
| 73 | + echo |
---|
| 74 | + [ $retval -eq 0 ] && rm -f $lockfile |
---|
| 75 | + return $retval |
---|
| 76 | +} |
---|
| 77 | + |
---|
| 78 | +restart() { |
---|
| 79 | + stop |
---|
| 80 | + start |
---|
| 81 | +} |
---|
| 82 | + |
---|
| 83 | +reload() { |
---|
| 84 | + restart |
---|
| 85 | +} |
---|
| 86 | + |
---|
| 87 | +force_reload() { |
---|
| 88 | + restart |
---|
| 89 | +} |
---|
| 90 | + |
---|
| 91 | +rh_status() { |
---|
| 92 | + # run checks to determine if the service is running or use generic status |
---|
| 93 | + status $prog |
---|
| 94 | +} |
---|
| 95 | + |
---|
| 96 | +rh_status_q() { |
---|
| 97 | + rh_status >/dev/null 2>&1 |
---|
| 98 | +} |
---|
| 99 | + |
---|
| 100 | + |
---|
| 101 | +case "$1" in |
---|
| 102 | + start) |
---|
| 103 | + rh_status_q && exit 0 |
---|
| 104 | + $1 |
---|
| 105 | + ;; |
---|
| 106 | + stop) |
---|
| 107 | + rh_status_q || exit 0 |
---|
| 108 | + $1 |
---|
| 109 | + ;; |
---|
| 110 | + restart) |
---|
| 111 | + $1 |
---|
| 112 | + ;; |
---|
| 113 | + reload) |
---|
| 114 | + rh_status_q || exit 7 |
---|
| 115 | + $1 |
---|
| 116 | + ;; |
---|
| 117 | + force-reload) |
---|
| 118 | + force_reload |
---|
| 119 | + ;; |
---|
| 120 | + status) |
---|
| 121 | + rh_status |
---|
| 122 | + ;; |
---|
| 123 | + condrestart|try-restart) |
---|
| 124 | + rh_status_q || exit 0 |
---|
| 125 | + restart |
---|
| 126 | + ;; |
---|
| 127 | + *) |
---|
| 128 | + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" |
---|
| 129 | + exit 2 |
---|
| 130 | +esac |
---|
| 131 | +exit $? |
---|