#!/bin/bash
#chkconfig: 345 95 05
#This checks to see if the given mount point exists for ZFS (or anything really).
#If the location is mounted, it is safe to start the CrashPlan service. If it isn't, then make sure the service is stopped.
#We check this because CrashPlan writing files to the virtual machine root disk will quickly fill it and will prevent ZFS (or other mounts) from working.
LOCATION="/mnt/StoragePool"
start() {
#Check to see if the location is mounted
if mountpoint -q $LOCATION; then
#The location is mounted, yay. Start the service.
service crashplan start
return 0
else
#The location is not mounted, boo. Make sure it isn't running.
service crashplan stop
return 1
fi
}
stop() {
#Simply stop the service from running
service crashplan stop
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=3
;;
esac
exit 0