84 lines
1.8 KiB
Bash
Executable File
84 lines
1.8 KiB
Bash
Executable File
#! /bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: onenode
|
|
# Required-Start: creoled libvirt-bin opennebula openvswitch-switch
|
|
# Required-Stop: creoled libvirt-bin opennebula openvswitch-switch
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Node vm management
|
|
# Description: Suspend and resume VM of OpenNebula node
|
|
### END INIT INFO
|
|
|
|
# Author: Jaime Melis <jmelis@opennebula.org>
|
|
|
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
|
DESC="OpenNebula Node"
|
|
NAME=onevm-all
|
|
DAEMON=/usr/share/eole/sbin/$NAME
|
|
DAEMON_ARGS="-w"
|
|
SCRIPTNAME=/etc/init.d/onenode
|
|
PID_FILE=/var/run/one/onenode
|
|
CREDS=/var/lib/one/.one/one_auth
|
|
|
|
# Exit if the package is not installed
|
|
[ -x "$DAEMON" ] || exit 0
|
|
|
|
# Load the VERBOSE setting and other rcS variables
|
|
. /lib/init/vars.sh
|
|
|
|
# Define LSB log_* functions.
|
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
|
. /lib/lsb/init-functions
|
|
|
|
#
|
|
# Function that starts the daemon/service
|
|
#
|
|
do_start()
|
|
{
|
|
${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "resume"
|
|
}
|
|
|
|
#
|
|
# Function that stops the daemon/service
|
|
#
|
|
do_stop()
|
|
{
|
|
${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "suspend"
|
|
}
|
|
|
|
do_status()
|
|
{
|
|
${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "status"
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
|
do_start
|
|
case "$?" in
|
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
esac
|
|
;;
|
|
stop)
|
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
|
do_stop
|
|
case "$?" in
|
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
esac
|
|
;;
|
|
status)
|
|
do_status
|
|
;;
|
|
restart|force-reload)
|
|
echo "Not supported action"
|
|
;;
|
|
*)
|
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
|
exit 3
|
|
;;
|
|
esac
|
|
|
|
:
|