You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
520 B

#!/usr/bin/env bash
# CONSTANTS
BASEDIR=$(dirname "$0")
NAME=
# FUNCTIONS
function usage {
echo "usage: $(basename "$0") { name }"
}
function parse_options {
while [[ $# -gt 0 ]]; do
case "$1" in
--help | -h)
usage && exit 0
;;
*)
if [[ -z $NAME ]]; then
NAME=$1
else
echo >&2 "Unknown option: $1" && usage && exit 2
fi
;;
esac
shift 1 # Move to the next argument
done
}
function start {
vmid=$(pct-lookup $NAME)
pct start $vmid
}
# MAIN
set -Eue
parse_options $*
start