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"
72 LOGIN=`echo $LINE | grep login`
75 LOGINS="$LOGINS\n"`echo $LOGIN | cut -d: -f2 | sed -e 's/^ *//' -e 's/ *$//'`
80 printf "Logins:\n$LOGINS\n"
82 NUM=`echo $LOGINS | wc -l`
84 printf -- "--------\n$NUM\n\n"
86 printf "Stopping...\n"
92 grep "Stg stopped successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
98 if [ "$COUNT" == "....." ]
100 printf "Failed to stop stg in 5 sec.\n"