Skip to content

Instantly share code, notes, and snippets.

@ArneAnka
Last active June 28, 2020 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArneAnka/d3af4c4130346115d653c2035878fa8e to your computer and use it in GitHub Desktop.
Save ArneAnka/d3af4c4130346115d653c2035878fa8e to your computer and use it in GitHub Desktop.
#!/bin/bash
HOST=192.168.1.50
# Check if the script is being executed as root
if [[ $EUID -ne 0 ]]; then
echo -e "πŸ₯΄ \033[0;31mThis script must be run as root \033[0m"
exit 1
fi
# Ping the storage server to determin connectivity
if ping -q -c 1 -W 1 $HOST > /dev/null 2>&1; then
echo -e "πŸ‘ \033[0;32mLan up\033[0m"
else
echo -e "πŸ”₯ \033[0;31mLan down\033[0m"
exit 1
fi
# Try to mount backup dir
if mount -t nfs -o rw,resvport,rsize=65536,wsize=65536,intr,nolock,locallocks,rdirplus,noac,noacl,readahead=128,noatime,nfc,actimeo=0 $HOST:/tank/backup ~/nfs_general/backup 2> /dev/null
then
echo -e "πŸ‘ \033[0;32mSuccessfully\033[0m mounted backup."
else
echo -e "πŸ”₯ \033[0;31mFailed\033[0m to mount backup"
fi
# Try to mount home dir
if mount -t nfs -o rw,resvport,rsize=65536,wsize=65536,intr,nolock,locallocks,rdirplus,noac,noacl,readahead=128,noatime,nfc,actimeo=0 $HOST:/tank/home ~/nfs_general/home 2> /dev/null
then
echo -e "πŸ‘ \033[0;32mSuccessfully\033[0m mounted home."
else
echo -e "πŸ”₯ \033[0;31mFailed\033[0m to mount home"
fi
# Try to mount media dir
if mount -t nfs -o rw,resvport,rsize=65536,wsize=65536,intr,nolock,locallocks,rdirplus,noac,noacl,readahead=128,noatime,nfc,actimeo=0 $HOST:/tank/media ~/nfs_general/media 2> /dev/null
then
echo -e "πŸ‘ \033[0;32mSuccessfully\033[0m mounted media."
else
echo -e "πŸ”₯ \033[0;31mFailed\033[0m to mount media"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment