Last active
June 28, 2020 09:34
-
-
Save ArneAnka/d3af4c4130346115d653c2035878fa8e to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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