first fixes in the systemd/ area
[sfa.git] / init.d / sfa-cm
1 #!/bin/bash
2 #
3 # sfa   Wraps PLCAPI into the SFA compliant API
4 #
5 # chkconfig: 2345 5 99
6 #
7 # description:   Wraps PLCAPI into the SFA compliant API
8 #
9
10 echo "sfa-cm is no longer supported"
11 echo "you should consider rpm -e sfa-cm"
12 exit 1
13
14 # Source config
15 [ -f /etc/sfa/sfa_config.sh ] && . /etc/sfa/sfa_config.sh
16
17 # source function library
18 . /etc/init.d/functions
19
20 init_key() {
21     # if key doesnt exist use sfa_componenet_setup to get it  
22     if [ ! -f /var/lib/sfa/server.key ]; then
23         /usr/bin/sfa_component_setup.py -k
24     fi
25 }
26
27 start() {
28         echo -n $"Starting SFA:  "
29
30         if [ "$SFA_CM_ENABLED" ]; then
31             echo "Component Mgr"
32             # make sure server key (nodes private key) exists first
33             init_key
34             /usr/bin/sfa-start.py -c -d $OPTIONS
35         fi
36
37         RETVAL=$?
38         echo
39         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sfa
40
41 }
42
43 stop() {
44     echo -n $"Shutting down SFA: "
45     killproc sfa-start.py
46     RETVAL=$?
47
48     echo
49     [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sfa
50 }
51
52
53
54 case "$1" in
55   start)
56     start
57     ;;
58   stop)
59     stop
60     ;;
61   restart|reload)
62     stop
63     start
64     ;;
65   condrestart)
66     if [ -f /var/lock/subsys/sfa ]; then
67         stop
68         start
69     fi
70     ;;
71   status)
72     status sfa
73     RETVAL=$?
74     ;;
75   *)
76     echo $"Usage: $0 {start|stop|restart|condrestart|status}"
77     exit 1
78 esac
79
80 exit $RETVAL
81