3 # plc Manages all PLC services on this machine
7 # description: Manages all PLC services on this machine
9 # $Id: host.init,v 1.5 2006/04/18 15:39:34 thierry 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
22 # Total number of errors
25 # Count the exit status of the last command
28 ERRORS=$(($ERRORS+$?))
33 if cut -d' ' -f2 /proc/mounts | grep -q "$1" ; then
42 echo -n $"Mounting PLC: "
44 if ! mounted $PLC_ROOT ; then
45 if ! e2fsck -a $PLC_ROOT.img | logger -t "PLC" ; then
48 mount -o loop $PLC_ROOT.img $PLC_ROOT
51 if ! mounted $PLC_ROOT/data ; then
52 mount -t none -o bind,rw $PLC_DATA $PLC_ROOT/data
55 if ! mounted $PLC_ROOT/proc ; then
56 mount -t proc none $PLC_ROOT/proc
60 [ $ERRORS -eq 0 ] && success $"PLC unmount" || failure $"PLC unmount"
69 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS start $*
75 echo -n $"Unmounting PLC: "
77 for dir in $PLC_ROOT/proc $PLC_ROOT/data $PLC_ROOT ; do
78 if mounted $dir ; then
84 [ $ERRORS -eq 0 ] && success $"PLC unmount" || failure $"PLC unmount"
90 if mounted $PLC_ROOT ; then
91 chroot $PLC_ROOT /sbin/service plc $PLC_OPTIONS stop $*
101 lines=$(mount | grep $PLC_ROOT)
102 if [ -z "$lines" ] ; then
103 echo "==== $PLC_ROOT is *not* mounted"
105 echo "==== The following mount points remain active"
111 shift $(($OPTIND - 1))
136 echo "Usage: $0 {start|stop|restart|mount|umount|mountstatus}"