/etc/init.d/zfs-share is in zfsutils-linux 0.6.5.6-0ubuntu8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #!/bin/sh
### BEGIN INIT INFO
# Provides: shareiscsi sharenfs sharesmb zfs-share
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: iscsi iscsitarget istgt nfs-kernel-server samba
# Should-Stop: iscsi iscsitarget istgt nfs-kernel-server samba
# Short-Description: Network share OpenZFS datasets.
# Description: Run the `zfs share -a` or `zfs unmount -a` commands
# for controlling iSCSI, NFS, or CIFS network shares.
### END INIT INFO
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 "Sharing OpenZFS filesystems"
log_progress_msg "filesystems"
zfs share -a
RET=$?
if [ $RET != 0 ] ; then
log_end_msg $RET
exit $RET
fi
log_end_msg 0
}
do_stop()
{
log_begin_msg "Unsharing OpenZFS filesystems"
log_progress_msg "filesystems"
zfs unshare -a
RET=$?
# Ignore a non-zero `zfs` result so that a busy OpenZFS instance
# does not hang the system during shutdown.
if [ $RET != 0 ] ; then
log_end_msg $RET
fi
log_end_msg 0
}
case "$1" in
(start)
case "$ZFS_SHARE" in
([Oo][Ff][Ff]|[Nn][Oo]|'')
exit 0
;;
esac
do_start
;;
(stop)
case "$ZFS_UNSHARE" in
([Oo][Ff][Ff]|[Nn][Oo]|'')
exit 0
;;
esac
do_stop
;;
(force-reload|reload|restart|status)
# no-op
;;
(*)
[ -n "$1" ] && echo "Error: Unknown command $1."
echo "Usage: $0 {start|stop}"
exit 3
;;
esac
|