3 # sfa Wraps PLCAPI into the SFA compliant API
7 # description: Wraps PLCAPI into the SFA compliant API
14 [ -f /etc/sfa/sfa_config ] && . /etc/sfa/sfa_config
16 # source function library
17 . /etc/init.d/functions
19 # Regenerate configuration files - almost verbatim from plc.init
24 # Regenerate the main configuration file from default values
25 # overlaid with site-specific and current values.
26 # Thierry -- 2007-07-05 : values in plc_config.xml are *not* taken into account here
28 /etc/sfa/default_config.xml
29 /etc/sfa/configs/site.xml
31 for file in "${files[@]}" ; do
32 if [ -n "$force" -o $file -nt /etc/sfa/plc_config.xml ] ; then
33 tmp=$(mktemp /tmp/plc_config.xml.XXXXXX)
34 plc-config --xml "${files[@]}" >$tmp
35 if [ $? -eq 0 ] ; then
36 mv $tmp /etc/sfa/plc_config.xml
37 chmod 444 /etc/sfa/plc_config.xml
39 echo "PLC: Warning: Invalid configuration file(s) detected"
46 # Convert configuration to various formats
47 if [ -n "$force" -o /etc/sfa/plc_config.xml -nt /etc/sfa/plc_config ] ; then
48 plc-config --shell >/etc/sfa/plc_config
50 if [ -n "$force" -o /etc/sfa/plc_config.xml -nt /etc/sfa/plc_config.py ] ; then
51 plc-config --python >/etc/sfa/plc_config.py
53 if [ -n "$force" -o /etc/sfa/plc_config.xml -nt /etc/sfa/php/plc_config.php ] ; then
55 plc-config --php >/etc/sfa/php/plc_config.php
63 echo -n $"Starting SFA: "
65 if [ "$SFA_REGISTRY_ENABLED" ]; then
67 daemon /usr/bin/sfa-server.py -r -d $OPTIONS
70 if [ "$SFA_AGGREGATE_ENABLED" ]; then
72 daemon /usr/bin/sfa-server.py -a -d $OPTIONS
75 if [ "$SFA_SM_ENABLED" ]; then
77 daemon /usr/bin/sfa-server.py -s -d $OPTIONS
82 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sfa
87 echo -n $"Shutting down SFA: "
88 killproc sfa-server.py
92 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sfa
99 reload) reload force ;;
100 restart) stop; start ;;
102 if [ -f /var/lock/subsys/sfa ]; then
112 echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"