-
-
Save mikho/b5a7946c80528d129bb0ca0086a9909a to your computer and use it in GitHub Desktop.
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/bash | |
# Check if your storage is mounted | |
if [ $(mount | grep 'username@username.your-storagebox.de:/mountingdir' | wc -l) -ne 1 ] | |
then | |
# umask=000 is for permitions 777 | |
echo 'storageboxpassword' | sshfs -o umask=000 username@username.your-storagebox.de:/mountingdir /backup/folder -o password_stdin,allow_other | |
# Allow your storage to mount if ιτ is busy | |
secs=$((2 * 2)) | |
while [ $secs -gt 0 ]; do | |
echo -ne "$secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
if [ $(mount | grep 'username@username.your-storagebox.de:/mountingdir' | wc -l) -ne 1 ] | |
then | |
echo 'SSHFS could not be mounted.' | |
else | |
echo 'SSHFS has been mounted.' | |
fi | |
else | |
echo 'SSHFS is already mounted.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment