Repository navigation
Expand file tree
/
Copy pathstack
More file actions
executable file
·82 lines (69 loc) · 1.49 KB
/
Copy pathstack
File metadata and controls
executable file
·82 lines (69 loc) · 1.49 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# BP 09/16/2011 13:43
# This script will give user to
# list all the calpont stacks
# reserve a calpont stack
# release a calpont stack
# Help to use a test stack without stepping each other.
#
DB=stacks
usage()
{
echo "Usage:" >&2
echo " ${0##*/} list" >&2
echo " ${0##*/} reserve stackname who" >&2
echo " ${0##*/} release stackname who" >&2
}
cmd="$1"
argc=$#
if [ -z "$cmd" -o "$cmd" = "-h" ]; then
usage
exit 1
fi
if [ $(expr 'list' : "$cmd") -gt 0 ]; then
cmd=list
INST=$2
elif [ $(expr 'reserve' : "$cmd") -gt 2 ]; then
cmd=reserve
INST=$4
elif [ $(expr 'release' : "$cmd") -gt 2 ]; then
cmd=release
INST=$4
fi
if [ -z "$INSTALLDIR" ]; then
INSTALLDIR="/usr/local/Calpont"
if [ $INST ]; then
INSTALLDIR=$INST
fi
export INSTALLDIR
fi
if [ -z "$MYSQLCMD" ]; then
if [ -d "$INSTALLDIR/mysql" ]; then
# Linux.
MYSQLCMD="$INSTALLDIR/mysql/bin/mysql -h 10.100.4.51 -u root --database=$DB"
else
# Windows.
MYSQLCMD="$INSTALLDIR/bin/mysql -h 10.100.4.51 -u root --database=$DB"
fi
export MYSQLCMD
fi
good=0
if [ "$cmd" = "list" ]; then
sql="call list_stacks()"
$MYSQLCMD -e "$sql"
good=1
fi
if [ "$cmd" = "reserve" -a $argc -ge 3 ]; then
sql="call reserve_stack('$2', '$3')"
$MYSQLCMD -e "$sql"
good=1
fi
if [ "$cmd" = "release" -a $argc -ge 3 ]; then
sql="call release_stack('$2', '$3')"
$MYSQLCMD -e "$sql"
good=1
fi
if [ $good -eq 0 ]; then
usage
exit 1
fi