--- /dev/null
+#!/bin/sh
+
+BASEPATH=$1
+
+if [ "$BASEPATH" == "" ]
+then
+ printf "Usage: $0 <path>\n"
+ exit -1
+fi
+
+if [ ! -d "$BASEPATH" ]
+then
+ printf "Path '$BASEPATH' does not exist or not a directory.\n"
+ exit -1
+fi
+
+cd "$BASEPATH/stg/projects/stargazer"
+./build debug
+make clean
+make
+
+cd "$BASEPATH/stg/projects/sgconf"
+./build debug
+make clean
+make
--- /dev/null
+#!/bin/sh
+
+BASEPATH=$1
+ARCHIVE=$2
+CURPATH=`pwd`
+GIT=/usr/bin/git
+TAR=/bin/tar
+RM=/bin/rm
+
+if [ "$BASEPATH" == "" ]
+then
+ printf "Usage: $0 <path>\n"
+ exit -1
+fi
+
+if [ ! -d "$BASEPATH" ]
+then
+ printf "Path '$BASEPATH' does not exist or not a directory.\n"
+ exit -1
+fi
+
+$GIT clone "https://gitorious.org/stg/stg.git" "$BASEPATH/stg"
+
+if [ "$ARCHIVE" != "" ]
+then
+ $RM -rf "$BASEPATH/stg/.git"
+
+ $TAR -C "$BASEPATH" -jcf "$BASEPATH/stg.tar" "stg"
+fi
--- /dev/null
+#!/bin/sh
+
+MKTEMP=/usr/bin/mktemp
+RM=/bin/rm
+
+printf "Creating temporary dir... "
+DIR=`$MKTEMP -d`
+
+if [ "$DIR" == "" ]
+then
+ printf "Failed.\nTemporary dir is empty.\n"
+ exit -1
+fi
+
+if [ ! -d "$DIR" ]
+then
+ printf "Failed.\nTemporary dir '$DIR' does not exist or not a directory.\n"
+ exit -1
+fi
+
+LOGFILE=`date "+%Y-%m-%d-%H%M%S.log"`
+
+printf "Ok.\nCloning... "
+./clone.sh "$DIR" >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+ printf "Failed.\n"
+ exit -1
+else
+ printf "Ok.\nBuilding... "
+fi
+./build.sh "$DIR" >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+ printf "Failed.\n"
+ exit -1
+else
+ printf "Ok.\nTesting... "
+fi
+./test.sh "$DIR" # >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+ printf "Failed.\n"
+ exit -1
+else
+ printf "Ok.\nCleaning up... "
+fi
+
+$RM -rf $DIR
+if [ "$?" != "0" ]
+then
+ printf "Failed.\n"
+ exit -1
+else
+ printf "Ok.\n"
+fi
--- /dev/null
+#!/bin/sh
+
+login=$1
+param=$2
+oldValue=$3
+newValue=$4
--- /dev/null
+#! /bin/sh
+
+# Login
+LOGIN=$1
+
+# User IP
+IP=$2
+
+# Cash
+CASH=$3
+
+# User ID
+ID=$4
+
+# Selected dirs to connect
+DIRS=$5
+
+TARIFFNAME=$6
--- /dev/null
+#! /bin/sh
+
+# Login
+LOGIN=$1
+
+# User IP
+IP=$2
+
+# Cash
+CASH=$3
+
+# User ID
+ID=$4
+
+# Selected dirs to disconnect
+DIRS=$5
+
+TARIFFNAME=$6
--- /dev/null
+password=geahonjehjfofnhammefahbbbfbmpkmkmmefahbbbfbmpkmkmmefahbbbfbmpkmkaa
+ChgConf=1
+ChgPassword=1
+ChgStat=1
+ChgCash=1
+UsrAddDel=1
+ChgTariff=1
+ChgAdmin=1
--- /dev/null
+Fee=1.000000
+Free=2.000000
+NoDiscount0=0
+NoDiscount1=0
+NoDiscount2=0
+NoDiscount3=0
+NoDiscount4=0
+NoDiscount5=0
+NoDiscount6=0
+NoDiscount7=0
+NoDiscount8=0
+NoDiscount9=0
+PassiveCost=3.000000
+Period=day
+PriceDayA0=5.000000
+PriceDayA1=0.000000
+PriceDayA2=0.000000
+PriceDayA3=0.000000
+PriceDayA4=0.000000
+PriceDayA5=0.000000
+PriceDayA6=0.000000
+PriceDayA7=0.000000
+PriceDayA8=0.000000
+PriceDayA9=0.000000
+PriceDayB0=3.500000
+PriceDayB1=0.000000
+PriceDayB2=0.000000
+PriceDayB3=0.000000
+PriceDayB4=0.000000
+PriceDayB5=0.000000
+PriceDayB6=0.000000
+PriceDayB7=0.000000
+PriceDayB8=0.000000
+PriceDayB9=0.000000
+PriceNightA0=4.000000
+PriceNightA1=0.000000
+PriceNightA2=0.000000
+PriceNightA3=0.000000
+PriceNightA4=0.000000
+PriceNightA5=0.000000
+PriceNightA6=0.000000
+PriceNightA7=0.000000
+PriceNightA8=0.000000
+PriceNightA9=0.000000
+PriceNightB0=2.500000
+PriceNightB1=0.000000
+PriceNightB2=0.000000
+PriceNightB3=0.000000
+PriceNightB4=0.000000
+PriceNightB5=0.000000
+PriceNightB6=0.000000
+PriceNightB7=0.000000
+PriceNightB8=0.000000
+PriceNightB9=0.000000
+SinglePrice0=0
+SinglePrice1=0
+SinglePrice2=0
+SinglePrice3=0
+SinglePrice4=0
+SinglePrice5=0
+SinglePrice6=0
+SinglePrice7=0
+SinglePrice8=0
+SinglePrice9=0
+Threshold0=1000
+Threshold1=0
+Threshold2=0
+Threshold3=0
+Threshold4=0
+Threshold5=0
+Threshold6=0
+Threshold7=0
+Threshold8=0
+Threshold9=0
+Time0=6:0-18:0
+Time1=0:0-0:0
+Time2=0:0-0:0
+Time3=0:0-0:0
+Time4=0:0-0:0
+Time5=0:0-0:0
+Time6=0:0-0:0
+Time7=0:0-0:0
+Time8=0:0-0:0
+Time9=0:0-0:0
+TraffType=up+down
--- /dev/null
+Address=
+AlwaysOnline=1
+CreationTime=1123487395
+Credit=0.000000
+CreditExpire=0
+DisabledDetailStat=0
+Down=0
+Email=
+Group=
+IP=192.168.0.5
+Note=
+Passive=0
+Password=123456
+Phone=
+RealName=
+Tariff=tariff
+TariffChange=
+Userdata0=
+Userdata1=
+Userdata2=
+Userdata3=
+Userdata4=
+Userdata5=
+Userdata6=
+Userdata7=
+Userdata8=
+Userdata9=
--- /dev/null
+Cash=100
+D0=0
+D1=0
+D2=0
+D3=0
+D4=0
+D5=0
+D6=0
+D7=0
+D8=0
+D9=0
+FreeMb=0
+LastActivityTime=0
+LastCashAdd=0
+LastCashAddTime=0
+PassiveTime=0
+U0=0
+U1=0
+U2=0
+U3=0
+U4=0
+U5=0
+U6=0
+U7=0
+U8=0
+U9=0
--- /dev/null
+ALL 192.168.0.0/16 DIR1
+ALL 172.16.0.0/12 DIR1
+ALL 10.0.0.0/8 DIR1
+ALL 0.0.0.0/0 DIR0
--- /dev/null
+PidFile = -STG-PATH-/stargazer.pid
+LogFile = -STG-PATH-/stargazer.log
+Rules = -STG-PATH-/rules
+ModulesPath = -STG-PATH-/modules
+DetailStatWritePeriod=1/6
+StatWritePeriod = 10
+DayFee = 1
+DayFeeIsLastDay = yes
+DayResetTraff = 1
+SpreadFee = no
+FreeMbAllowInet = no
+WriteFreeMbTraffCost = no
+FullFee=no
+ShowFeeInCash=yes
+ExecutersNum = 1
+ExecMsgKey = 5555
+# MonitorDir=/var/stargazer/monitor
+ScriptParams = tariffName
+
+<DirNames>
+ DirName0 = dir
+ DirName1 = dir2
+ DirName2 = dir3
+ DirName3 =
+ DirName4 =
+ DirName5 = dir5
+ DirName6 =
+ DirName7 =
+ DirName8 =
+ DirName9 =
+</DirNames>
+
+<StoreModule store_files>
+ WorkDir = -STG-PATH-/db
+
+ ConfOwner = root
+ ConfGroup = root
+ ConfMode = 600
+
+ StatOwner = root
+ StatGroup = root
+ StatMode = 640
+
+ UserLogOwner = root
+ UserLogGroup = root
+ UserLogMode = 640
+</StoreModule>
+
+<Modules>
+ <Module auth_ao>
+ </Module>
+
+ <Module conf_sg>
+ Port = 5555
+ BindAddress = localhost
+ </Module>
+</Modules>
--- /dev/null
+#!/bin/sh
+
+BASEPATH=$1
+
+if [ "$BASEPATH" == "" ]
+then
+ printf "Usage: $0 <path>\n"
+ exit -1
+fi
+
+if [ ! -d "$BASEPATH" ]
+then
+ printf "Path '$BASEPATH' does not exist or not a directory.\n"
+ exit -1
+fi
+
+STGPATH="$BASEPATH/stg/projects/stargazer"
+
+cp "stuff/stargazer-files.conf" "$STGPATH/stargazer.conf"
+cp "stuff/rules" "$STGPATH/"
+cp "stuff/OnConnect" "$STGPATH/"
+cp "stuff/OnDisconnect" "$STGPATH/"
+cp "stuff/OnChange" "$STGPATH/"
+cp -R "stuff/db-stub" "$STGPATH/db"
+
+sed -i "s|-STG-PATH-|$STGPATH|g" "$STGPATH/stargazer.conf"
+
+LOGFILE=`pwd`"/"`date "+%Y-%m-%d-%H%M%S.console.log"`
+
+cd "$STGPATH"
+
+"$STGPATH/stargazer" "$STGPATH" >> "$LOGFILE" 2>&1 &
+
+COUNT=""
+while true
+do
+ grep "Stg started successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
+ if [ "$?" == "0" ]
+ then
+ break
+ fi
+ COUNT="$COUNT."
+ if [ "$COUNT" == "....." ]
+ then
+ printf "Failed to start stg in 5 sec.\n"
+ exit -1
+ fi
+ sleep 1
+done
+
+PID=`cat "$STGPATH/stargazer.pid"`
+printf "Started with pid $PID\n"
+
+SGCONFPATH="$BASEPATH/stg/projects/sgconf"
+
+RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-admins`
+
+if [ "$?" != "0" ]
+then
+ printf "Failed to get admins list. Result:\n$RES\n"
+ exit 0
+fi
+
+printf "Got admins list:\n$RES\n"
+
+printf "Stopping...\n"
+kill $PID
+
+COUNT=""
+while true
+do
+ grep "Stg stopped successfully" "$STGPATH/stargazer.log" > /dev/null 2> /dev/null
+ if [ "$?" == "0" ]
+ then
+ break
+ fi
+ COUNT="$COUNT."
+ if [ "$COUNT" == "....." ]
+ then
+ printf "Failed to stop stg in 5 sec.\n"
+ exit -1
+ fi
+ sleep 1
+done
+
+printf "Stopped.\n"