Skip to content

Instantly share code, notes, and snippets.

@oderwat
Created March 28, 2013 16:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oderwat/5264902 to your computer and use it in GitHub Desktop.
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…
#!/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