3 # plc Manages all PLC services on this machine
7 # description: Manages all PLC services on this machine
9 # $Id: host.init,v 1.1.1.1 2006/03/27 17:36:46 mlhuang Exp $
12 PATH=/sbin:/bin:/usr/bin:/usr/sbin
14 # Source function library.
15 . /etc/init.d/functions
17 # Source configuration
18 if [ -f /etc/sysconfig/plc -a -z "${PLC_ROOT}${PLC_DATA}" ] ; then
26 echo -n $"Mounting PLC: "
28 if ! cut -d' ' -f2 /proc/mounts | grep -q $PLC_ROOT ; then
29 if ! e2fsck -a $PLC_ROOT.img | logger -t "PLC" ; then
32 mount -o loop $PLC_ROOT.img $PLC_ROOT
33 RETVAL=$(($RETVAL+$?))
35 if ! cut -d' ' -f2 /proc/mounts | grep -q $PLC_ROOT/data ; then
36 mount -t none -o bind,rw $PLC_DATA $PLC_ROOT/data
37 RETVAL=$(($RETVAL+$?))
39 if ! cut -d' ' -f2 /proc/mounts | grep -q $PLC_ROOT/proc ; then
40 mount -t proc none $PLC_ROOT/proc
41 RETVAL=$(($RETVAL+$?))
44 if [ $RETVAL -eq 0 ]; then
51 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS start
57 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS stop
59 echo -n $"Unmounting PLC: "
62 RETVAL=$(($RETVAL+$?))
64 RETVAL=$(($RETVAL+$?))
66 RETVAL=$(($RETVAL+$?))
68 if [ $RETVAL -eq 0 ]; then
69 success $"PLC unmount"
71 failure $"PLC unmount"
87 echo "Usage: $0 {start|stop|restart}"