Skip to content

Instantly share code, notes, and snippets.

@Marc-Bender
Last active July 24, 2020 20:50
Show Gist options
  • Save Marc-Bender/caf9d9976a14ca1741fb595482d3426e to your computer and use it in GitHub Desktop.
Save Marc-Bender/caf9d9976a14ca1741fb595482d3426e to your computer and use it in GitHub Desktop.
Mounting script for nfs mounting various shares on my NAS
#! /bin/bash
address=$(sudo arp-scan -I enp5s0 -localnet | grep "Synology" | awk '{print $1'})
choice=$(echo -e "Filme\nMusik\nUnsortierte Musik" | dmenu -i -p "Which NAS share to mount?")
if [ "$choice" == "Filme" ]; then
volume=2
else
volume=1
fi
if [ $(df 2> /dev/null | grep --count "$choice") -ne 0 ]; then
sudo umount "/mnt/nas/$choice"
else
sudo mount -t nfs --source $address:/volume$volume/"$choice" --targ et /mnt/nas/"$choice" --rw
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment