add never logged in report
[freeside.git] / init.d / freeside-init
1 #! /bin/sh
2 #
3 # chkconfig: 345 86 16
4 # description: Freeside daemons
5
6 QUEUED_USER=%%%QUEUED_USER%%%
7
8 SELFSERVICE_USER=%%%SELFSERVICE_USER%%%
9 SELFSERVICE_MACHINES="%%%SELFSERVICE_MACHINES%%%"
10
11 #INSTALLSCRIPT/INSTALLSITEBIN from Makefile.PL
12 PATH="$PATH:/usr/local/bin"
13 export PATH
14
15 case "$1" in
16   start)
17         # Start daemons.
18         echo -n "Starting freeside-queued: "
19         freeside-queued $QUEUED_USER
20         echo "done."
21
22         #echo -n "Starting freeside-sqlradius-radacctd: "
23         #freeside-sqlradius-radacctd $QUEUED_USER
24         #echo "done."
25
26         echo -n "Starting freeside-prepaidd: "
27         freeside-prepaidd $QUEUED_USER
28         echo "done."
29
30         for MACHINE in $SELFSERVICE_MACHINES; do
31           echo -n "Starting freeside-selfservice-server to $MACHINE: "
32           freeside-selfservice-server $SELFSERVICE_USER $MACHINE
33           echo "done."
34         done
35
36         ;;
37   stop)
38         # Stop daemons.
39         echo -n "Stopping freeside-queued: "
40         kill `cat /var/run/freeside-queued.pid`
41         echo "done."
42
43         #and
44         killall freeside-queued
45
46         echo -n "Stopping freeside-sqlradius-radacctd: "
47         kill `cat /var/run/freeside-sqlradius-radacctd.pid`
48         echo "done."
49
50         echo -n "Stopping freeside-prepaidd: "
51         kill `cat /var/run/freeside-prepaidd.pid`
52         echo "done."
53
54         if [ -e /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid ]
55         then
56           echo -n "Stopping (old) freeside-selfservice-server: "
57           kill `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid`
58           rm /var/run/freeside-selfservice-server.$SELFSERVICE_USER.pid
59         fi
60
61         for MACHINE in $SELFSERVICE_MACHINES; do
62           echo -n "Stopping freeside-selfservice-server to $MACHINE: "
63           kill `cat /var/run/freeside-selfservice-server.$SELFSERVICE_USER.$MACHINE.pid`
64           echo "done."
65         done
66
67         ;;
68
69   restart)
70         $0 stop
71         $0 start
72         ;;
73   *)
74         echo "Usage: freeside {start|stop|restart}"
75         exit 1
76 esac
77
78 exit 0
79