forked from GsDevKit/gsDevKitHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstopStone
executable file
·65 lines (52 loc) · 1.38 KB
/
stopStone
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
#! /bin/bash
#=========================================================================
# Copyright (c) 2014, 2015 GemTalk Systems, LLC <[email protected]>.
#=========================================================================
echo "================="
echo " GsDevKit script: $(basename $0) $*"
echo "================="
usage() {
cat <<HELP
USAGE: $(basename $0) [-h] [-b] <stone-name>
Stop the named stone. Any statmonitor processes associated
with the stone will be stopped.
The netldi for the stone is left running unless the -b option
is specified.
OPTIONS
-h display help
-b stop the netldi for the stone
EXAMPLES
$(basename $0) -h
$(basename $0) kit
HELP
}
set -e # exit on error
if [ "${GS_HOME}x" = "x" ] ; then
echo "the GS_HOME environment variable needs to be defined"; exit 1
fi
stopNetldi=""
while getopts "bhns:" OPT ; do
case "$OPT" in
h) usage; exit 0;;
b) stopNetldi="true";;
*) usage; exit 1;;
esac
done
shift $(($OPTIND - 1))
if [ $# -ne 1 ]; then
usage; exit 1
fi
stoneName=$1
stonePath=$GS_HOME/gemstone/stones/${stoneName}
if [ -d "$stonePath" ] ; then
# set up stone environment
pushd $stonePath >& /dev/null
source $stonePath/stone.env
popd >& /dev/null
# stop the stone
$GS_HOME/bin/gs/stopGemstone
if [ "${stopNetldi}" = "true" ] ; then
$GS_HOME/bin/stopNetldi $stoneName
fi
fi
echo "...finished $(basename $0)"