5 if [ "$BASEPATH" == "" ]
7 printf "Usage: $0 <path>\n"
11 if [ ! -d "$BASEPATH" ]
13 printf "Path '$BASEPATH' does not exist or not a directory.\n"
17 STGPATH="$BASEPATH/stg/projects/stargazer"
19 cp "stuff/stargazer-files.conf" "$STGPATH/stargazer.conf"
20 cp "stuff/rules" "$STGPATH/"
21 cp "stuff/OnConnect" "$STGPATH/"
22 cp "stuff/OnDisconnect" "$STGPATH/"
23 cp "stuff/OnChange" "$STGPATH/"
24 cp -R "stuff/db-stub" "$STGPATH/db"
26 sed -i "s|-STG-PATH-|$STGPATH|g" "$STGPATH/stargazer.conf"
28 LOGFILE=`pwd`"/"`date "+%Y-%m-%d-%H%M%S.console.log"`
32 "$STGPATH/stargazer" "$STGPATH" >> "$LOGFILE" 2>&1 &
37 grep "Stg started successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
43 if [ "$COUNT" == "....." ]
45 printf "Failed to start stg in 5 sec.\n"
51 PID=`cat "$STGPATH/stargazer.pid"`
52 printf "Started with pid $PID\n"
54 SGCONFPATH="$BASEPATH/stg/projects/sgconf"
56 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-admins`
60 printf "Failed to get admins list. Result:\n$RES\n"
64 printf "Got admins list:\n$RES\n"
66 printf "Stopping...\n"
72 grep "Stg stopped successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
78 if [ "$COUNT" == "....." ]
80 printf "Failed to stop stg in 5 sec.\n"