-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkhget
More file actions
executable file
·37 lines (32 loc) · 784 Bytes
/
khget
File metadata and controls
executable file
·37 lines (32 loc) · 784 Bytes
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
29
30
31
32
33
34
35
36
37
#!/bin/bash
#set -x
#declare -r khgateway=spinoza
declare -r blockipprefix="172.16.128"
declare -r khctluser=root
declare -r khctl=/root/scripts/khctl
declare -r khctlcmd=acquireNodes
declare -r khgatewayuser=${khgatewayuser:-$USER}
declare -r ubootvarfile=/proc/device-tree/u-boot-env/khctlserver
declare -r SSH=ssh
if [[ -a $ubootvarfile ]]
then
khctlserver=$(cat $ubootvarfile)
fi
if [[ -z $khctlserver ]]
then
block=$1
if [[ -z $block ]]
then
echo "ERROR: must specify block"
echo "USAGE: $0 <blocknum>"
exit -1
fi
khctlserver=$blockipprefix.$block
shift
fi
if [[ -z $khgateway ]]
then
$SSH -q $khctluser@$khctlserver "$khctl $khctlcmd $@"
else
$SSH -q -t $khgatewayuser@$khgateway "$SSH -q $khctluser@$khctlserver \"$khctl $khctlcmd $@\""
fi