ia64/xen-unstable

annotate tools/hotplug/Linux/init.d/xendomains @ 19216:cb8ece5d7647

Fix typos in xendomains script.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 17 11:04:08 2009 +0000 (2009-02-17)
parents 67d9d2a4b988
children 8018f09ef039
rev   line source
keir@18770 1 #!/bin/bash
keir@18770 2 #
keir@18770 3 # /etc/init.d/xendomains
keir@18770 4 # Start / stop domains automatically when domain 0 boots / shuts down.
keir@18770 5 #
keir@18770 6 # chkconfig: 345 99 00
keir@18770 7 # description: Start / stop Xen domains.
keir@18770 8 #
keir@18770 9 # This script offers fairly basic functionality. It should work on Redhat
keir@18770 10 # but also on LSB-compliant SuSE releases and on Debian with the LSB package
keir@18770 11 # installed. (LSB is the Linux Standard Base)
keir@18770 12 #
keir@18770 13 # Based on the example in the "Designing High Quality Integrated Linux
keir@18770 14 # Applications HOWTO" by Avi Alkalay
keir@18770 15 # <http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/>
keir@18770 16 #
keir@18770 17 ### BEGIN INIT INFO
keir@18770 18 # Provides: xendomains
keir@18770 19 # Required-Start: $syslog $remote_fs xend
keir@18770 20 # Should-Start:
keir@18770 21 # Required-Stop: $syslog $remote_fs xend
keir@18770 22 # Should-Stop:
keir@18770 23 # Default-Start: 3 4 5
keir@18770 24 # Default-Stop: 0 1 2 6
keir@18770 25 # Default-Enabled: yes
keir@18770 26 # Short-Description: Start/stop secondary xen domains
keir@18770 27 # Description: Start / stop domains automatically when domain 0
keir@18770 28 # boots / shuts down.
keir@18770 29 ### END INIT INFO
keir@18770 30
keir@18770 31 # Correct exit code would probably be 5, but it's enough
keir@18770 32 # if xend complains if we're not running as privileged domain
keir@18770 33 if ! [ -e /proc/xen/privcmd ]; then
keir@18770 34 exit 0
keir@18770 35 fi
keir@18770 36
keir@18770 37 LOCKFILE=/var/lock/subsys/xendomains
keir@18770 38 XENDOM_CONFIG=/etc/sysconfig/xendomains
keir@18770 39
keir@18770 40 test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
keir@18770 41 if [ "$1" = "stop" ]; then exit 0;
keir@18770 42 else exit 6; fi; }
keir@18770 43
keir@18770 44 . $XENDOM_CONFIG
keir@18770 45
keir@18770 46 # Use the SUSE rc_ init script functions;
keir@18770 47 # emulate them on LSB, RH and other systems
keir@18770 48 if test -e /etc/rc.status; then
keir@18770 49 # SUSE rc script library
keir@18770 50 . /etc/rc.status
keir@18770 51 else
keir@18770 52 _cmd=$1
keir@18770 53 declare -a _SMSG
keir@18770 54 if test "${_cmd}" = "status"; then
keir@18770 55 _SMSG=(running dead dead unused unknown)
keir@18770 56 _RC_UNUSED=3
keir@18770 57 else
keir@18770 58 _SMSG=(done failed failed missed failed skipped unused failed failed)
keir@18770 59 _RC_UNUSED=6
keir@18770 60 fi
keir@18770 61 if test -e /etc/init.d/functions; then
keir@18770 62 # REDHAT
keir@18770 63 . /etc/init.d/functions
keir@18770 64 echo_rc()
keir@18770 65 {
keir@18770 66 #echo -n " [${_SMSG[${_RC_RV}]}] "
keir@18770 67 if test ${_RC_RV} = 0; then
keir@18770 68 success " [${_SMSG[${_RC_RV}]}] "
keir@18770 69 else
keir@18770 70 failure " [${_SMSG[${_RC_RV}]}] "
keir@18770 71 fi
keir@18770 72 }
keir@18770 73 elif test -e /lib/lsb/init-functions; then
keir@18770 74 # LSB
keir@18770 75 . /lib/lsb/init-functions
keir@18770 76 if alias log_success_msg >/dev/null 2>/dev/null; then
keir@18770 77 echo_rc()
keir@18770 78 {
keir@18770 79 echo " [${_SMSG[${_RC_RV}]}] "
keir@18770 80 }
keir@18770 81 else
keir@18770 82 echo_rc()
keir@18770 83 {
keir@18770 84 if test ${_RC_RV} = 0; then
keir@18770 85 log_success_msg " [${_SMSG[${_RC_RV}]}] "
keir@18770 86 else
keir@18770 87 log_failure_msg " [${_SMSG[${_RC_RV}]}] "
keir@18770 88 fi
keir@18770 89 }
keir@18770 90 fi
keir@18770 91 else
keir@18770 92 # emulate it
keir@18770 93 echo_rc()
keir@18770 94 {
keir@18770 95 echo " [${_SMSG[${_RC_RV}]}] "
keir@18770 96 }
keir@18770 97 fi
keir@18770 98 rc_reset() { _RC_RV=0; }
keir@18770 99 rc_failed()
keir@18770 100 {
keir@18770 101 if test -z "$1"; then
keir@18770 102 _RC_RV=1;
keir@18770 103 elif test "$1" != "0"; then
keir@18770 104 _RC_RV=$1;
keir@18770 105 fi
keir@18770 106 return ${_RC_RV}
keir@18770 107 }
keir@18770 108 rc_check()
keir@18770 109 {
keir@18770 110 return rc_failed $?
keir@18770 111 }
keir@18770 112 rc_status()
keir@18770 113 {
keir@18770 114 rc_failed $?
keir@18770 115 if test "$1" = "-r"; then _RC_RV=0; shift; fi
keir@18770 116 if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
keir@18770 117 if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
keir@18770 118 if test "$1" = "-v"; then echo_rc; shift; fi
keir@18770 119 if test "$1" = "-r"; then _RC_RV=0; shift; fi
keir@18770 120 return ${_RC_RV}
keir@18770 121 }
keir@18770 122 rc_exit() { exit ${_RC_RV}; }
keir@18770 123 rc_active()
keir@18770 124 {
keir@18770 125 if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
keir@18770 126 if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
keir@18770 127 return 1
keir@18770 128 }
keir@18770 129 fi
keir@18770 130
keir@18770 131 if ! which usleep >&/dev/null
keir@18770 132 then
keir@18770 133 usleep()
keir@18770 134 {
keir@18770 135 if [ -n "$1" ]
keir@18770 136 then
keir@18770 137 sleep $(( $1 / 1000000 ))
keir@18770 138 fi
keir@18770 139 }
keir@18770 140 fi
keir@18770 141
keir@18770 142 # Reset status of this service
keir@18770 143 rc_reset
keir@18770 144
keir@18770 145 ##
keir@18770 146 # Returns 0 (success) if the given parameter names a directory, and that
keir@18770 147 # directory is not empty.
keir@18770 148 #
keir@18770 149 contains_something()
keir@18770 150 {
keir@18770 151 if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
keir@18770 152 then
keir@18770 153 return 0
keir@18770 154 else
keir@18770 155 return 1
keir@18770 156 fi
keir@18770 157 }
keir@18770 158
keir@18770 159 # read name from xen config file
keir@18770 160 rdname()
keir@18770 161 {
keir@18770 162 NM=$(xm create --quiet --dryrun --defconfig "$1" |
keir@18770 163 sed -n 's/^.*(name \(.*\))$/\1/p')
keir@18770 164 }
keir@18770 165
keir@18770 166 rdnames()
keir@18770 167 {
keir@18770 168 NAMES=
keir@18770 169 if ! contains_something "$XENDOMAINS_AUTO"
keir@18770 170 then
keir@18770 171 return
keir@18770 172 fi
keir@18770 173 for dom in $XENDOMAINS_AUTO/*; do
keir@18770 174 rdname $dom
keir@18770 175 if test -z $NAMES; then
keir@18770 176 NAMES=$NM;
keir@18770 177 else
keir@18770 178 NAMES="$NAMES|$NM"
keir@18770 179 fi
keir@18770 180 done
keir@18770 181 }
keir@18770 182
keir@18770 183 parseln()
keir@18770 184 {
keir@18770 185 if [[ "$1" =~ "\(domain" ]]; then
keir@18770 186 name=;id=
keir@18770 187 else if [[ "$1" =~ "\(name" ]]; then
keir@18770 188 name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
keir@18770 189 else if [[ "$1" =~ "\(domid" ]]; then
keir@18770 190 id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
keir@18770 191 fi; fi; fi
keir@18770 192
keir@18770 193 [ -n "$name" -a -n "$id" ] && return 0 || return 1
keir@18770 194 }
keir@18770 195
keir@18770 196 is_running()
keir@18770 197 {
keir@18770 198 rdname $1
keir@18770 199 RC=1
keir@18770 200 name=;id=
keir@18770 201 while read LN; do
keir@18770 202 parseln "$LN" || continue
keir@18770 203 if test $id = 0; then continue; fi
keir@18770 204 case $name in
keir@18770 205 ($NM)
keir@18770 206 RC=0
keir@18770 207 ;;
keir@18770 208 esac
keir@18770 209 done < <(xm list -l | grep '(\(domain\|domid\|name\)')
keir@18770 210 return $RC
keir@18770 211 }
keir@18770 212
keir@18770 213 start()
keir@18770 214 {
keir@18770 215 if [ -f $LOCKFILE ]; then
keir@19209 216 echo -e "xendomains already running (lockfile exists)"
keir@18770 217 return;
keir@18770 218 fi
keir@18770 219
keir@18770 220 saved_domains=" "
keir@18770 221 if [ "$XENDOMAINS_RESTORE" = "true" ] &&
keir@18770 222 contains_something "$XENDOMAINS_SAVE"
keir@18770 223 then
keir@18770 224 mkdir -p $(dirname "$LOCKFILE")
keir@18770 225 touch $LOCKFILE
keir@18770 226 echo -n "Restoring Xen domains:"
keir@18770 227 saved_domains=`ls $XENDOMAINS_SAVE`
keir@18770 228 for dom in $XENDOMAINS_SAVE/*; do
keir@18770 229 if [ -f $dom ] ; then
keir@18770 230 HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
keir@18770 231 if [ $HEADER = "LinuxGuestRecord" ]; then
keir@18770 232 echo -n " ${dom##*/}"
keir@19209 233 XMR=`xm restore $dom 2>&1 1>/dev/null`
keir@19209 234 #xm restore $dom
keir@18770 235 if [ $? -ne 0 ]; then
keir@19216 236 echo -e "\nAn error occurred while restoring domain ${dom##*/}:\n$XMR"
keir@18770 237 rc_failed $?
keir@19209 238 echo -e '!'
keir@18770 239 else
keir@18770 240 # mv $dom ${dom%/*}/.${dom##*/}
keir@18770 241 rm $dom
keir@18770 242 fi
keir@18770 243 fi
keir@18770 244 fi
keir@18770 245 done
keir@19209 246 echo -e
keir@18770 247 fi
keir@18770 248
keir@18770 249 if contains_something "$XENDOMAINS_AUTO"
keir@18770 250 then
keir@18770 251 touch $LOCKFILE
keir@18770 252 echo -n "Starting auto Xen domains:"
keir@18770 253 # We expect config scripts for auto starting domains to be in
keir@18770 254 # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere
keir@18770 255
keir@18770 256 # Create all domains with config files in XENDOMAINS_AUTO.
keir@18770 257 # TODO: We should record which domain name belongs
keir@18770 258 # so we have the option to selectively shut down / migrate later
keir@18770 259 # If a domain statefile from $XENDOMAINS_SAVE matches a domain name
keir@18770 260 # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't
keir@18770 261 # restore correctly it requires administrative attention.
keir@18770 262 for dom in $XENDOMAINS_AUTO/*; do
keir@18770 263 echo -n " ${dom##*/}"
keir@18770 264 shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
keir@18770 265 echo $saved_domains | grep -w $shortdom > /dev/null
keir@18770 266 if [ $? -eq 0 ] || is_running $dom; then
keir@18770 267 echo -n "(skip)"
keir@18770 268 else
keir@19209 269 XMC=`xm create --quiet --defconfig $dom`
keir@19216 270 if [ $? -ne 0 ]; then
keir@19216 271 echo -e "\nAn error occurred while creating domain ${dom##*/}: $XMC\n"
keir@18770 272 rc_failed $?
keir@19209 273 echo -e '!'
keir@18770 274 else
keir@18770 275 usleep $XENDOMAINS_CREATE_USLEEP
keir@18770 276 fi
keir@18770 277 fi
keir@18770 278 done
keir@19209 279 fi
keir@18770 280 }
keir@18770 281
keir@18770 282 all_zombies()
keir@18770 283 {
keir@18770 284 name=;id=
keir@18770 285 while read LN; do
keir@18770 286 parseln "$LN" || continue
keir@18770 287 if test $id = 0; then continue; fi
keir@18770 288 if test "$state" != "-b---d" -a "$state" != "-----d"; then
keir@18770 289 return 1;
keir@18770 290 fi
keir@18770 291 done < <(xm list -l | grep '(\(domain\|domid\|name\)')
keir@18770 292 return 0
keir@18770 293 }
keir@18770 294
keir@18770 295 # Wait for max $XENDOMAINS_STOP_MAXWAIT for xm $1 to finish;
keir@18770 296 # if it has not exited by that time kill it, so the init script will
keir@18770 297 # succeed within a finite amount of time; if $2 is nonnull, it will
keir@18770 298 # kill the command as well as soon as no domain (except for zombies)
keir@19209 299 # are left (used for shutdown --all). Third parameter, if any, suppresses
keir@19209 300 # output of dots per working state (formatting issues)
keir@18770 301 watchdog_xm()
keir@18770 302 {
keir@18770 303 if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
keir@18770 304 exit
keir@18770 305 fi
keir@19209 306
keir@18770 307 usleep 20000
keir@18770 308 for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
keir@18770 309 # exit if xm save/migrate/shutdown is finished
keir@18770 310 PSAX=`ps axlw | grep "xm $1" | grep -v grep`
keir@18770 311 if test -z "$PSAX"; then exit; fi
keir@19209 312 if ! test -n "$3"; then echo -n '.'; fi
keir@19209 313 sleep 1
keir@18770 314 # go to kill immediately if there's only zombies left
keir@18770 315 if all_zombies && test -n "$2"; then break; fi
keir@18770 316 done
keir@18770 317 sleep 1
keir@18770 318 read PSF PSUID PSPID PSPPID < <(echo "$PSAX")
keir@18770 319 # kill xm $1
keir@18770 320 kill $PSPID >/dev/null 2>&1
keir@19209 321
keir@19209 322 echo -e .
keir@18770 323 }
keir@18770 324
keir@18770 325 stop()
keir@18770 326 {
keir@19209 327 exec 3>&2 2> /dev/null
keir@19209 328
keir@18770 329 # Collect list of domains to shut down
keir@18770 330 if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
keir@18770 331 rdnames
keir@18770 332 fi
keir@18770 333 echo -n "Shutting down Xen domains:"
keir@18770 334 name=;id=
keir@18770 335 while read LN; do
keir@18770 336 parseln "$LN" || continue
keir@18770 337 if test $id = 0; then continue; fi
keir@18770 338 echo -n " $name"
keir@18770 339 if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
keir@18770 340 eval "
keir@18770 341 case \"\$name\" in
keir@18770 342 ($NAMES)
keir@18770 343 # nothing
keir@18770 344 ;;
keir@18770 345 (*)
keir@19209 346 echo -e '(skip)'
keir@18770 347 continue
keir@18770 348 ;;
keir@18770 349 esac
keir@18770 350 "
keir@18770 351 fi
keir@18770 352 # XENDOMAINS_SYSRQ chould be something like just "s"
keir@18770 353 # or "s e i u" or even "s e s i u o"
keir@18770 354 # for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so
keir@18770 355 if test -n "$XENDOMAINS_SYSRQ"; then
keir@18770 356 for sysrq in $XENDOMAINS_SYSRQ; do
keir@18770 357 echo -n "(SR-$sysrq)"
keir@19209 358 XMR=`xm sysrq $id $sysrq 2>&1 1>/dev/null`
keir@18770 359 if test $? -ne 0; then
keir@19216 360 echo -e "\nAn error occurred while doing sysrq on domain:\n$XMR\n"
keir@18770 361 rc_failed $?
keir@18770 362 echo -n '!'
keir@18770 363 fi
keir@18770 364 # usleep just ignores empty arg
keir@18770 365 usleep $XENDOMAINS_USLEEP
keir@18770 366 done
keir@18770 367 fi
keir@18770 368 if test "$state" = "-b---d" -o "$state" = "-----d"; then
keir@18770 369 echo -n "(zomb)"
keir@18770 370 continue
keir@18770 371 fi
keir@18770 372 if test -n "$XENDOMAINS_MIGRATE"; then
keir@18770 373 echo -n "(migr)"
keir@18770 374 watchdog_xm migrate &
keir@18770 375 WDOG_PID=$!
keir@19209 376 XMR=`xm migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null`
keir@18770 377 if test $? -ne 0; then
keir@19216 378 echo -e "\nAn error occurred while migrating domain:\n$XMR\n"
keir@18770 379 rc_failed $?
keir@19209 380 echo -e '!'
keir@19209 381
keir@18770 382 kill $WDOG_PID >/dev/null 2>&1
keir@18770 383 else
keir@18770 384 kill $WDOG_PID >/dev/null 2>&1
keir@19209 385
keir@19209 386 echo -e .
keir@19209 387 usleep 1000
keir@18770 388 continue
keir@18770 389 fi
keir@18770 390 fi
keir@18770 391 if test -n "$XENDOMAINS_SAVE"; then
keir@18770 392 echo -n "(save)"
keir@18770 393 watchdog_xm save &
keir@18770 394 WDOG_PID=$!
keir@18770 395 mkdir -p "$XENDOMAINS_SAVE"
keir@19209 396 XMR=`xm save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null`
keir@18770 397 if test $? -ne 0; then
keir@19216 398 echo -e "\nAn error occurred while saving domain:\n$XMR\n"
keir@18770 399 rc_failed $?
keir@19209 400 echo -e '!'
keir@18770 401 kill $WDOG_PID >/dev/null 2>&1
keir@18770 402 else
keir@18770 403 kill $WDOG_PID >/dev/null 2>&1
keir@19209 404 echo -e .
keir@19209 405 usleep 1000
keir@18770 406 continue
keir@18770 407 fi
keir@18770 408 fi
keir@18770 409 if test -n "$XENDOMAINS_SHUTDOWN"; then
keir@18770 410 # XENDOMAINS_SHUTDOWN should be "--halt --wait"
keir@18770 411 echo -n "(shut)"
keir@18770 412 watchdog_xm shutdown &
keir@18770 413 WDOG_PID=$!
keir@19209 414 XMR=`xm shutdown $id $XENDOMAINS_SHUTDOWN 2>&1 1>/dev/null`
keir@18770 415 if test $? -ne 0; then
keir@19216 416 echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
keir@18770 417 rc_failed $?
keir@19209 418 echo -e '!'
keir@18770 419 fi
keir@18770 420 kill $WDOG_PID >/dev/null 2>&1
keir@18770 421 fi
keir@18770 422 done < <(xm list -l | grep '(\(domain\|domid\|name\)')
keir@18770 423
keir@18770 424 # NB. this shuts down ALL Xen domains (politely), not just the ones in
keir@18770 425 # AUTODIR/*
keir@18770 426 # This is because it's easier to do ;-) but arguably if this script is run
keir@18770 427 # on system shutdown then it's also the right thing to do.
keir@18770 428 if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
keir@18770 429 # XENDOMAINS_SHUTDOWN_ALL should be "--all --halt --wait"
keir@18770 430 echo -n " SHUTDOWN_ALL "
keir@19209 431 watchdog_xm shutdown 1 false &
keir@18770 432 WDOG_PID=$!
keir@19209 433 XMR=`xm shutdown $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null`
keir@18770 434 if test $? -ne 0; then
keir@19216 435 echo -e "\nAn error occurred while shutting down all domains: $XMR\n"
keir@18770 436 rc_failed $?
keir@19209 437 echo -e '!'
keir@18770 438 fi
keir@18770 439 kill $WDOG_PID >/dev/null 2>&1
keir@18770 440 fi
keir@18770 441
keir@18770 442 # Unconditionally delete lock file
keir@18770 443 rm -f $LOCKFILE
keir@19209 444
keir@19209 445 exec 2>&3
keir@18770 446 }
keir@18770 447
keir@18770 448 check_domain_up()
keir@18770 449 {
keir@18770 450 name=;id=
keir@18770 451 while read LN; do
keir@18770 452 parseln "$LN" || continue
keir@18770 453 if test $id = 0; then continue; fi
keir@18770 454 case $name in
keir@18770 455 ($1)
keir@18770 456 return 0
keir@18770 457 ;;
keir@18770 458 esac
keir@18770 459 done < <(xm list -l | grep '(\(domain\|domid\|name\)')
keir@18770 460 return 1
keir@18770 461 }
keir@18770 462
keir@18770 463 check_all_auto_domains_up()
keir@18770 464 {
keir@18770 465 if ! contains_something "$XENDOMAINS_AUTO"
keir@18770 466 then
keir@18770 467 return 0
keir@18770 468 fi
keir@18770 469 missing=
keir@18770 470 for nm in $XENDOMAINS_AUTO/*; do
keir@18770 471 rdname $nm
keir@18770 472 found=0
keir@18770 473 if check_domain_up "$NM"; then
keir@18770 474 echo -n " $name"
keir@18770 475 else
keir@18770 476 missing="$missing $NM"
keir@18770 477 fi
keir@18770 478 done
keir@18770 479 if test -n "$missing"; then
keir@18770 480 echo -n " MISS AUTO:$missing"
keir@18770 481 return 1
keir@18770 482 fi
keir@18770 483 return 0
keir@18770 484 }
keir@18770 485
keir@18770 486 check_all_saved_domains_up()
keir@18770 487 {
keir@18770 488 if ! contains_something "$XENDOMAINS_SAVE"
keir@18770 489 then
keir@18770 490 return 0
keir@18770 491 fi
keir@18770 492 missing=`/bin/ls $XENDOMAINS_SAVE`
keir@18770 493 echo -n " MISS SAVED: " $missing
keir@18770 494 return 1
keir@18770 495 }
keir@18770 496
keir@18770 497 # This does NOT necessarily restart all running domains: instead it
keir@18770 498 # stops all running domains and then boots all the domains specified in
keir@18770 499 # AUTODIR. If other domains have been started manually then they will
keir@18770 500 # not get restarted.
keir@18770 501 # Commented out to avoid confusion!
keir@18770 502
keir@18770 503 restart()
keir@18770 504 {
keir@18770 505 stop
keir@18770 506 start
keir@18770 507 }
keir@18770 508
keir@18770 509 reload()
keir@18770 510 {
keir@18770 511 restart
keir@18770 512 }
keir@18770 513
keir@18770 514
keir@18770 515 case "$1" in
keir@18770 516 start)
keir@18770 517 start
keir@18770 518 rc_status
keir@18770 519 if test -f $LOCKFILE; then rc_status -v; fi
keir@18770 520 ;;
keir@18770 521
keir@18770 522 stop)
keir@18770 523 stop
keir@18770 524 rc_status -v
keir@18770 525 ;;
keir@18770 526
keir@18770 527 restart)
keir@18770 528 restart
keir@18770 529 ;;
keir@18770 530 reload)
keir@18770 531 reload
keir@18770 532 ;;
keir@18770 533
keir@18770 534 status)
keir@18770 535 echo -n "Checking for xendomains:"
keir@18770 536 if test ! -f $LOCKFILE; then
keir@18770 537 rc_failed 3
keir@18770 538 else
keir@18770 539 check_all_auto_domains_up
keir@18770 540 rc_status
keir@18770 541 check_all_saved_domains_up
keir@18770 542 rc_status
keir@18770 543 fi
keir@18770 544 rc_status -v
keir@18770 545 ;;
keir@18770 546
keir@18770 547 *)
keir@18770 548 echo "Usage: $0 {start|stop|restart|reload|status}"
keir@18770 549 rc_failed 3
keir@18770 550 rc_status -v
keir@18770 551 ;;
keir@18770 552 esac
keir@18770 553
keir@18770 554 rc_exit