forked from GsDevKit/gsDevKitHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startStone
executable file
·104 lines (90 loc) · 2.22 KB
/
startStone
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! /bin/bash
#=========================================================================
# Copyright (c) 2014, 2015 GemTalk Systems, LLC <dhenrich@gemtalksystems.com>.
#=========================================================================
echo "================="
echo " GsDevKit script: $(basename $0) $*"
echo "================="
usage() {
cat <<HELP
USAGE: $(basename $0) [-h] -b] [-C] [-N] [-R] [-w <waitstone-timeout>] <stone-name>
Start the stone process for the given stone.
OPTIONS
-b
Start netldi
-C
Startup for conversion.
-h
display help
-N
Startup without transaction logs.
-R
Startup for restore
-w <waitstone-timeout>
if present wait up to <waitstone-timeout> minutes for the stone to
properly start
EXAMPLES
$(basename $0) -h
$(basename $0) kit
$(basename $0) -w 5 kit
HELP
}
set -e # exit on error
waitTime=""
ARG=""
startnetldi=""
while getopts "bhw:CNR" OPT ; do
case "$OPT" in
b) startnetldi="true" ;;
C)
if [ "${ARGS}x" != "x" ] ; then
echo "Only one of -C -N or -R options may be specified"
exit 1
fi
ARG="-C"
;;
h) usage; exit 0 ;;
N)
if [ "${ARGS}x" != "x" ] ; then
echo "Only one of -C -N or -R options may be specified"
exit 1
fi
ARG="-N"
;;
R)
if [ "${ARGS}x" != "x" ] ; then
echo "Only one of -C -N or -R options may be specified"
exit 1
fi
ARG="-R"
;;
w) waitTime="${OPTARG}" ;;
*) usage; exit 1 ;;
esac
done
shift $(($OPTIND - 1))
if [ "${GS_HOME}x" = "x" ] ; then
echo "the GS_HOME environment variable needs to be defined"; exit 1
fi
if [ $# -ne 1 ]; then
usage; exit 1
fi
stoneName=$1
stonePath=$GS_HOME/gemstone/stones/$stoneName
# set up stone environment
pushd $stonePath >& /dev/null
source $stonePath/stone.env
popd >& /dev/null
# start the stone
$GS_HOME/bin/gs/startGemstone $ARG
if [ "${waitTime}x" = "x" ] ; then
if [ "${GS_TRAVIS}x" != "x" ] ; then
$stonePath/product/bin/waitstone $GEMSTONE_NAME 2
fi
else
$stonePath/product/bin/waitstone $GEMSTONE_NAME $waitTime
fi
if [ "${startnetldi}" = "true" ] ; then
$GS_HOME/bin/startNetldi $stoneName
fi
echo "...finished $(basename $0)"