#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
. /lib/init/vars.sh
[ -f /etc/default/zfs ] && . /etc/default/zfs
do_start() {
log_begin_msg “Starting ZFS subsystem”
log_progress_msg “filesystems”
zfs mount -a
RET=$?
if [ $RET != 0 ] ; then
log_end_msg $RET
exit $RET
fi
log_end_msg 0
log_begin_msg “Exporting ZFS filesystems”
zfs share -a
log_end_msg $?
}
do_stop() {
log_begin_msg “Stopping ZFS subsystem”
log_progress_msg “filesystems”
zfs umount -a
RET=$?
if [ $RET != 0 ] ; then
log_end_msg $RET
fi
log_end_msg 0
}
do_status() {
zpool status
echo ”
zpool list
true
}
case “$1” in
start)
[ -z “$ZFS_MOUNT” ] && exit 0
do_start
;;
stop)
[ -z “$ZFS_UNMOUNT” ] && exit 0
do_stop
;;
status)
do_status
;;
*)
[ -n “$1” ] && echo “Error: Unknown command $1.”
echo “Usage: $0 {start|stop|status}”
exit 3
;;
esac
chmod 755 /etc/init.d/zfs