5 source `dirname $0`/functions
7 if [ "$BASEPATH" == "" ]
9 printf "Usage: $0 <path>\n"
13 if [ ! -d "$BASEPATH" ]
15 printf "Path '$BASEPATH' does not exist or not a directory.\n"
19 STGPATH="$BASEPATH/stg/projects/stargazer"
21 cp "stuff/stargazer-files.conf" "$STGPATH/stargazer.conf"
22 cp "stuff/rules" "$STGPATH/"
23 cp "stuff/OnConnect" "$STGPATH/"
24 cp "stuff/OnDisconnect" "$STGPATH/"
25 cp "stuff/OnChange" "$STGPATH/"
26 cp -R "stuff/db-stub" "$STGPATH/db"
29 groups | grep root > /dev/null 2> /dev/null
32 groups | grep wheel > /dev/null 2> /dev/null
35 printf "Can't find neither 'root' nor 'wheel' group.\n"
41 subst "-STG-PATH-" "$STGPATH" "$STGPATH/stargazer.conf"
42 subst "-STG-GROUP-" "$GROUP" "$STGPATH/stargazer.conf"
45 LOGFILE="$CURPATH/"`date "+%Y-%m-%d-%H%M%S.console.log"`
49 printf "Starting Stargazer... "
51 "$STGPATH/stargazer" "$STGPATH" >> "$LOGFILE" 2>&1 &
56 grep "Stg started successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
62 if [ "$COUNT" == "....." ]
64 printf "Failed to start stg in 5 sec.\n"
70 PID=`cat "$STGPATH/stargazer.pid"`
71 printf "Started with pid $PID\n"
73 printf "\nTesting admins:\n"
74 "$CURPATH/test_admins.sh" "$BASEPATH"
75 printf "\nTesting services:\n"
76 "$CURPATH/test_services.sh" "$BASEPATH"
85 grep "Stg stopped successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
91 if [ "$COUNT" == "....." ]
93 printf "Failed to stop stg in 5 sec.\n"