Devblog

Mes notes de développeur

Script pour SSHFS

Plus comme un petit pense-bête qu'un vrai article, voici comment je monte/démonte un dossier via SSHFS

#!/bin/sh

sshfs -o port=2200,follow_symlinks user@192.168.0.42:/var/www/ /var/www/web
if [ "$?" -eq 0 ]; then
  echo "/var/www/web volume mounted."
else
  echo "Error mounting /var/www/web."
  fusermount -uz /var/www/web
  if [ "$?" -eq 0 ]; then
    echo "/var/www/web volume unmounted"
  fi 
fi

En lançant ce script, ça toggle le mount/unmount. Utile quand on perd la connexion !