#!/bin/bash

VM=$1

PROGNAME="$(basename "$0")"

error_exit()
{
# ----------------------------------------------------------------
# Function for exit due to fatal program error
#   Accepts 1 argument:
#     string containing descriptive error message
#   error_exit "$LINENO: An error has occurred."
# ----------------------------------------------------------------
  echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
  exit 1
}

/scripts/unraid/vm_stop.sh "$VM"
error_exit "$LINENO: An error has occurred."
echo "$VM stop successfull" >&2

/scripts/unraid/vm_start.sh "$VM"
error_exit "$LINENO: An error has occurred."
echo "$VM start successfull" >&2
