diff --git a/sshfser.sh b/sshfser.sh new file mode 100644 index 0000000..3c9621e --- /dev/null +++ b/sshfser.sh @@ -0,0 +1,35 @@ +GIT="/home/service/Gitea" +USER="alf" +IPWURZEL="100.87.87" +MOUNTPUNKT="/home/service/FILME" +SERVERWAHL="80 81" +source $GIT/logger/logger.sh +log_init "$GIT/logger/Logs/sshfs.log" +log_start + +log_info "Prüfen, ob schon etwas auf $MOUNTPUNKT gemountet ist" +mount | grep "$MOUNTPUNKT" +MOUNTET=$? +log_info "ERR: $MOUNTET" + +case $MOUNTET in + 1) + log_info "Verzeichnis ist frei." + log_info "Bitte Server wählen..." + SERVER=$(gum choose $SERVERWAHL) + log_info "Gewählter Server: $SERVER" + sshfs -o IdentityFile="$HOME/id_$SERVER" -p2222 $USER@$IPWURZEL.$SERVER:/srv/ $MOUNTPUNKT + log_info "ERR: $?" + ;; + 0) + log_info "Verzeichnis ist belegt! Unmount..." + umount $MOUNTPUNKT + log_info "ERR: $?" + ;; + + *) + log_error "Ungewöhnlicher Rückgabewert: $MOUNTET" + ;; +esac + +log_end \ No newline at end of file