tower tracking, RT#15538
[freeside.git] / init.d / freeside-init
index c9bcebe..0589ceb 100644 (file)
@@ -2,12 +2,26 @@
 #
 # chkconfig: 345 86 16
 # description: Freeside daemons
+#
+### BEGIN INIT INFO
+# Provides:          freeside
+# Required-Start:    $time $remote_fs
+# Required-Stop:     $remote_fs
+# Should-Start:      postgresql mysql
+# Should-Stop:       postgresql mysql
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start Freeside daemons at boot time
+# Description:       Enable Freeside daemons
+### END INIT INFO
 
 QUEUED_USER=%%%QUEUED_USER%%%
 
 SELFSERVICE_USER=%%%SELFSERVICE_USER%%%
 SELFSERVICE_MACHINES="%%%SELFSERVICE_MACHINES%%%"
 
+IF=eth0
+
 #INSTALLSCRIPT/INSTALLSITEBIN from Makefile.PL
 PATH="$PATH:/usr/local/bin"
 export PATH
@@ -18,7 +32,10 @@ case "$1" in
   start)
         # Start daemons.
         echo -n "Starting freeside-queued: "
+        #perl -MDBIx::Profile /usr/local/bin/freeside-queued $QUEUED_USER
         freeside-queued $QUEUED_USER
+        #export NYTPROF="file=/usr/local/etc/freeside/nytprof.out"
+        #PERL5OPT="-d:NYTProf" freeside-queued $QUEUED_USER
         echo "done."
 
         echo -n "Starting freeside-sqlradius-radacctd: "
@@ -43,6 +60,24 @@ case "$1" in
           echo "done."
         done
 
+        echo -n "Starting freeside-selfservice-xmlrpcd: "
+        freeside-selfservice-xmlrpcd $SELFSERVICE_USER
+        echo "done."
+
+        if [ -e /usr/local/bin/torrus ]; then
+          echo -n "Starting torrus collector: "
+          /usr/local/bin/torrus collector --tree=main
+          echo "done."
+        fi
+
+        echo -n "Starting freeside-torrus-srvderive: "
+        freeside-torrus-srvderive $QUEUED_USER
+        echo "done."
+
+        #ip=`/sbin/ifconfig $IF | grep 'inet addr:' | cut -d: -f2- | cut -d' ' -f1`
+        #cp /opt/rt3/etc/RT_SiteConfig.pm.ORIG /opt/rt3/etc/RT_SiteConfig.pm
+        #perl -pi -e "s/localhost/$ip/" /opt/rt3/etc/RT_SiteConfig.pm
+
         ;;
   stop)
         # Stop daemons.
@@ -95,6 +130,24 @@ case "$1" in
           fi
         done
 
+        if [ -e /var/run/freeside/selfservice-xmlrpcd.pid ]; then
+          echo -n "Stopping freeside-selfservice-xmlrpcd: "
+          kill `cat /var/run/freeside/selfservice-xmlrpcd.pid`
+          echo "done."
+        fi
+
+        if [ -e /var/run/freeside/torrus-srvderive.pid ]; then
+          echo -n "Stopping freeside-torrus-srvderive: "
+          kill `cat /var/run/freeside/torrus-srvderive.pid`
+          echo "done."
+        fi
+
+        if [ -e /var/run/torrus/collector.main_?.pid ]; then
+          echo -n "Stopping torrus collector: "
+          kill `cat /var/run/torrus/collector.main_?.pid`
+          echo "done."
+        fi
+
         ;;
 
   restart)