3 # plc Manages all PLC services on this machine
7 # description: Manages all PLC services on this machine
9 # $Id: plc.init,v 1.6 2005/04/24 19:48:11 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 ] ; then
25 while getopts "vh" opt ; do
39 echo -n $"Mounting PLC: "
41 if ! grep -q $PLC_ROOT.img /proc/mounts ; then
42 if ! e2fsck -a $PLC_ROOT.img | logger -t "PLC" ; then
45 mount -o loop $PLC_ROOT.img $PLC_ROOT
46 RETVAL=$(($RETVAL+$?))
48 if ! grep -q $PLC_DATA /proc/mounts ; then
49 mount -t none -o bind,rw $PLC_DATA $PLC_ROOT/data
50 RETVAL=$(($RETVAL+$?))
52 if ! grep -q $PLC_ROOT/proc /proc/mounts ; then
53 mount -t proc none $PLC_ROOT/proc
54 RETVAL=$(($RETVAL+$?))
57 if [ $RETVAL -eq 0 ]; then
64 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS start
70 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS stop
72 echo -n $"Unmounting PLC: "
75 RETVAL=$(($RETVAL+$?))
77 RETVAL=$(($RETVAL+$?))
79 RETVAL=$(($RETVAL+$?))
81 if [ $RETVAL -eq 0 ]; then
82 success $"PLC unmount"
84 failure $"PLC unmount"
101 echo "Usage: $0 {start|stop|restart}"