Created
March 28, 2013 16:54
-
-
Save oderwat/5264902 to your computer and use it in GitHub Desktop.
Hier ein Script, das ich für und mit @tekshrek gebaut habe um bei ihm eine externe Platte die an der #Synology NAS hängt "remote" vom Mac auswerfen zu können. Das Script selber gehört auf die Synology und ist mit Hilfe verschiedener Informationen aus dem Forum gezaubert! Anwendung: In der Synology z.B. unter /root/eject-usb.sh ablegen (chmod u+x…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# I have this as /root/eject-usb.sh and execute it from the mac by ssh with keypair | |
# With no parameters we list the currently mounted devices | |
if [ -z "$1" ] | |
then | |
# Listing mounted USB Drives | |
/usr/syno/bin/synousbdisk -enum | |
exit 0 | |
fi | |
# Find the given USB hard drive device | |
haveit=`/usr/syno/bin/synousbdisk -enum|grep "$1"` | |
if [ -z "$haveit" ] | |
then | |
echo "USB \"$1\" Drive not found. Exiting..." 1>&2 | |
exit 1 | |
fi | |
# Remove from the 'gui' list | |
cp /tmp/usbtab /tmp/usbtab.old | |
grep -v $1 /tmp/usbtab.old > /tmp/usbtab | |
rm -f /tmp/usbtab.old | |
# Flush data to drive | |
sync | |
# Do the unmount | |
/usr/syno/bin/synousbdisk -umount $1 | |
echo "You may now disconnect the USB drive!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment