4 # description: Freeside daemons
8 # Required-Start: $time $remote_fs
9 # Required-Stop: $remote_fs
10 # Should-Start: postgresql mysql
11 # Should-Stop: postgresql mysql
12 # Default-Start: 2 3 4 5
14 # Short-Description: Start Freeside daemons at boot time
15 # Description: Enable Freeside daemons
18 QUEUED_USER=%%%QUEUED_USER%%%
19 API_USER=%%%API_USER%%%
21 SELFSERVICE_USER=%%%SELFSERVICE_USER%%%
22 SELFSERVICE_MACHINES="%%%SELFSERVICE_MACHINES%%%"
26 #INSTALLSCRIPT/INSTALLSITEBIN from Makefile.PL
27 PATH="$PATH:/usr/local/bin"
30 [ -r /etc/default/freeside ] && . /etc/default/freeside
36 for MACHINE in $SELFSERVICE_MACHINES; do
37 echo -n "Starting freeside-selfservice-server to $MACHINE: "
38 freeside-selfservice-server $SELFSERVICE_USER $MACHINE
42 echo -n "Starting freeside-selfservice-xmlrpcd: "
43 freeside-selfservice-xmlrpcd $SELFSERVICE_USER
46 echo -n "Starting freeside-xmlrpcd: "
47 freeside-xmlrpcd $API_USER
50 # echo -n "Starting freeside-jsonrpcd: "
51 # freeside-jsonrpcd $API_USER
54 echo -n "Starting freeside-queued: "
55 #perl -MDBIx::Profile /usr/local/bin/freeside-queued $QUEUED_USER
56 freeside-queued $QUEUED_USER
57 #export NYTPROF="file=/usr/local/etc/freeside/nytprof.out"
58 #PERL5OPT="-d:NYTProf" freeside-queued $QUEUED_USER
61 echo -n "Starting freeside-sqlradius-radacctd: "
62 freeside-sqlradius-radacctd $QUEUED_USER
65 echo -n "Starting freeside-prepaidd: "
66 freeside-prepaidd $QUEUED_USER
69 echo -n "Starting freeside-cdrrewrited: "
70 freeside-cdrrewrited $QUEUED_USER
73 echo -n "Starting freeside-cdrd: "
74 freeside-cdrd $QUEUED_USER
77 echo -n "Starting freeside-cdrrated: "
78 freeside-cdrrated $QUEUED_USER
81 if [ -e /usr/local/bin/torrus ]; then
82 echo -n "Starting torrus collector: "
83 /usr/local/bin/torrus collector --tree=main
87 echo -n "Starting freeside-torrus-srvderive: "
88 freeside-torrus-srvderive $QUEUED_USER
91 if [ -e /opt/rt3/etc/RT_SiteConfig.pm.ORIG_WEBDEMO_HACK ]; then
92 ip=`/sbin/ifconfig $IF | grep 'inet addr:' | cut -d: -f2- | cut -d' ' -f1`
93 cp /opt/rt3/etc/RT_SiteConfig.pm.ORIG_WEBDEMO_HACK /opt/rt3/etc/RT_SiteConfig.pm
94 perl -pi -e "s/localhost/$ip/" /opt/rt3/etc/RT_SiteConfig.pm
100 echo -n "Stopping freeside-queued: "
101 [ -e /var/run/freeside-queued.pid ] && kill `cat /var/run/freeside-queued.pid`
104 killall freeside-queued
107 if [ -e /var/run/freeside-sqlradius-radacctd.pid ]; then
108 echo -n "Stopping freeside-sqlradius-radacctd: "
109 kill `cat /var/run/freeside-sqlradius-radacctd.pid`
113 if [ -e /var/run/freeside-prepaidd.pid ]; then
114 echo -n "Stopping freeside-prepaidd: "
115 kill `cat /var/run/freeside-prepaidd.pid`
119 if [ -e /var/run/freeside-cdrd.pid ]; then
120 echo -n "Stopping freeside-cdrd: "
121 kill `cat /var/run/freeside-cdrd.pid`
125 if [ -e /var/run/freeside-cdrrewrited.pid ]; then
126 echo -n "Stopping freeside-cdrrewrited: "
127 kill `cat /var/run/freeside-cdrrewrited.pid`
131 if [ -e /var/run/freeside-cdrrated.pid ]; then
132 echo -n "Stopping freeside-cdrrated: "
133 kill `cat /var/run/freeside-cdrrated.pid`
137 if [ -e /var/run/freeside/torrus-srvderive.pid ]; then
138 echo -n "Stopping freeside-torrus-srvderive: "
139 kill `cat /var/run/freeside/torrus-srvderive.pid`
143 if [ -e /var/run/torrus/collector.main_?.pid ]; then
144 echo -n "Stopping torrus collector: "
145 kill `cat /var/run/torrus/collector.main_?.pid`
149 if [ -e /var/run/freeside/xmlrpcd.pid ]; then
150 echo -n "Stopping freeside-xmlrpcd: "
151 kill `cat /var/run/freeside/xmlrpcd.pid`
155 # if [ -e /var/run/freeside/jsonrpcd.pid ]; then
156 # echo -n "Stopping freeside-jsonrpcd: "
157 # kill `cat /var/run/freeside/jsonrpcd.pid`
161 if [ -e /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid ]
163 echo -n "Stopping (old) freeside-selfservice-server: "
164 kill `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid`
166 rm /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid
170 if [ -z "$SELFSERVICE_MACHINES" ]; then SELFSERVICE_MACHINES='localhost'; fi
171 for MACHINE in $SELFSERVICE_MACHINES; do
172 if [ -e /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid ]
174 echo -n "Stopping freeside-selfservice-server to $MACHINE"
175 kill `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid`
177 while [ $howlong -gt 0 ] && kill -0 `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid` 2>/dev/null; do
180 howlong=$(( $howlong - 1 ))
181 if [ $howlong -eq 0 ]; then
182 echo -n 'forcefully.'
183 kill -9 `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid`
187 rm /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid
191 if [ -e /var/run/freeside/selfservice-xmlrpcd.pid ]; then
192 echo -n "Stopping freeside-selfservice-xmlrpcd: "
193 kill `cat /var/run/freeside/selfservice-xmlrpcd.pid`
204 echo "Usage: freeside {start|stop|restart}"