23 lines
764 B
Bash
Executable File
23 lines
764 B
Bash
Executable File
#!/bin/bash
|
|
UPCLAPI_CMD="./build/upclapi"
|
|
USAGE="on_cloud.sh home-cloud-dir-name tsksrvc [ args ]
|
|
example: on_cloud.sh wuji/dvara info
|
|
"
|
|
[ -z "$1" ] || [ "$1" == "-h" ] && echo "$USAGE" && $UPCLAPI_CMD -h && exit
|
|
. ./env
|
|
CLOUD_CONFIG_PATH="$KLDS_HOME/$1/$KLDS_CONFIG"
|
|
[ ! -r "$CLOUD_CONFIG_PATH" ] && echo "$CLOUD_CONFIG_PATH not found" && exit
|
|
[ -z "$2" ] && echo "No tsksrvc defined" && echo "$USAGE" && exit 1
|
|
case "$2" in
|
|
c|create|createserver) TSKSRVC="createserver" ;;
|
|
d|delete|deleteserver) TSKSRVC="deleteserver" ;;
|
|
i|info) TSKSRVC="infoserver" ;;
|
|
*) TSKSRVC="$2"
|
|
esac
|
|
|
|
if $UPCLAPI_CMD -c "$TSKSRVC" -f "$CLOUD_CONFIG_PATH" ; then
|
|
[ "$TSKSRVC" == "createserver" ] && "$ROOT_KLDS"/bin/hosts_list.sh "$1" -src "$KLDS_HOME" -filter pub
|
|
fi
|
|
|
|
|