Sophie

Sophie

distrib > Mandriva > cs4.0 > x86_64 > by-pkgid > 42c894d558ab12b5abb15f55fef85c3f > files > 12

partimage-0.6.4-7mdk.src.rpm

#!/bin/sh
#
# description: Runs partimage server
# chkconfig: 345 90 60

# Source function library.
. /etc/rc.d/init.d/functions

JAIL=/var/lib/partimage

test -d $JAIL || exit 0

RETVAL=0

#
#	See how we were called.
#

prog="partimaged"

# don't avoid killing processes not running in the same root
inmyroot() {
	echo "$*"
}

start() {
	# Check if partimaged is already running
	if [ ! -f /var/lock/subsys/partimaged ]; then
	    gprintf "Starting %s: " "$prog"
	    daemon /usr/sbin/partimaged -D --chroot $JAIL
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/partimaged
	    echo
	fi
	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc /usr/sbin/partimaged
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/partimaged
	echo
        return $RETVAL
}


restart() {
	stop
	start
}	

reload() {
	restart
}	

status_at() {
 	status /usr/sbin/partimaged
}

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload|restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/partimaged ]; then
	    restart
	fi
	;;
status)
	status_at
	;;
*)
	gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$0"
	exit 1
esac

exit $?
exit $RETVAL