blob: 60b720d6271a4b7a0877c353b4528bbae4475227 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|