Skip to content

Instantly share code, notes, and snippets.

@mikho
Created February 10, 2022 07:41
Show Gist options
  • Save mikho/b5a7946c80528d129bb0ca0086a9909a to your computer and use it in GitHub Desktop.
Save mikho/b5a7946c80528d129bb0ca0086a9909a to your computer and use it in GitHub Desktop.
#!/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