summaryrefslogtreecommitdiffstats
path: root/ext/solus/bin/client
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-01-30 13:59:28 +0100
committertv <tv@nomic.retiolum>2013-01-30 13:59:28 +0100
commit609dd2e9e89c047399ab2e554e3411df7e6e2676 (patch)
treea2d0337e4843f3c52f4a96885be45b6b36d4f4ca /ext/solus/bin/client
parent695a7acf30d0f6be1191a162fe147d4810210c52 (diff)
ext solus client: initial commit to access the SolusVM Client API
Diffstat (limited to 'ext/solus/bin/client')
-rwxr-xr-xext/solus/bin/client28
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/solus/bin/client b/ext/solus/bin/client
new file mode 100755
index 00000000..60b720d6
--- /dev/null
+++ b/ext/solus/bin/client
@@ -0,0 +1,28 @@
+#! /bin/sh
+# usage: client ACTION
+# ACTION: boot, info, reboot, shutdown, or status
+# environment:
+# api_url URL to the client API like https://<MASTER IP>:5656/api/client
+# api_key
+# api_hash
+set -euf
+
+url="$api_url/command.php"
+key="$api_key"
+hash="$api_hash"
+
+action="${1-$ACTION}"
+
+case "$action" in
+ (info)
+ # get all the information
+ action="$action&ipaddr=true&hdd=true&mem=true&bw=true";;
+esac
+
+abspath="`readlink -f "$0"`"
+bindir="`dirname "$abspath"`"
+libdir="`dirname "$bindir"`/lib"
+export PATH="$libdir:$PATH"
+
+curl -sS -d key="$key" -d hash="$hash" -d action="$action" "$url" |
+ parse-return-data