Mount Bind/scriptv2

Aus

S99ZZZ_customize.sh: Eine leicht modifizierte Version des start/stop Skriptes für viele Verzeichnisse und mit Meldungen im System Logbuch:

#!/bin/sh
# chmod 755 /usr/syno/etc.defaults/rc.d/S99ZZZ_customize.sh
# mount/bind some folders on startup and umount them on shutdown/reboot (http://www.synology-wiki.de/index.php/Mount_Bind)
# Write to system log, event ids in /usr/syno/synosdk/texts/enu/events (http://forum.synology.com/enu/viewtopic.php?f=27&t=6396)
mountit()
{
	# $1 mount what, $2 mount where
	if [ -e "$2" ]
	then
		/usr/syno/bin/synologset1  sys err 0x11800000 "$0: "$2" exists"
	else
		/bin/mkdir -p "$2"
		/bin/mount -o bind "$1" "$2"
		/usr/syno/bin/synologset1  sys info 0x11800000 "$0: Mounted "$1" to "$2""
	fi
	return
}
umountit()
{
	# $1 umount what
    /bin/umount $1 && /bin/rmdir "$1" && /usr/syno/bin/synologset1  sys info 0x11800000 "$0: Unmounted "$1""
	return
}

case $1 in
start)
	mountit /volume2/mehr_urlaubsvideos/ /volume1/video/weitere_videos/
	mountit /volume1 /volume1/etc/VOL1
	mountit /volume2 /volume1/etc/VOL2
	;;
stop)
	umountit /volume1/video/weitere_videos/
	umountit /volume1/etc/VOL1
	umountit /volume1/etc/VOL2
	;;
*)
	echo "Usage: $0 [start|stop]"
    ;;
esac