TringaliLuca

Automount SSHFS from NAS to OSMC

Aug 28th, 2018
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sudo nano /home/osmc/autosshfs.sh
  2. #!/bin/bash
  3. _SSHHOST="192.168.1.66"
  4. _SSHUSER="myuser"
  5. _SSHPASS="mypass"
  6. _DATADIR="/media/osmc/Film"
  7. _REMOTEDIR="/media/b788ff5f-fc19-4cd1-8a22-1935ce2edc33/famiglia/Video/Film"
  8.  
  9. while true; do
  10. if ping -c1 $_SSHHOST | grep -q "1 packets received"; then
  11. break
  12. fi
  13. sleep 10
  14. done
  15.  
  16. echo $_SSHPASS | sshfs -o password_stdin $_SSHUSER@$_SSHHOST:$_REMOTEDIR $_DATADIR
  17.  
  18. ####################
  19. chmod +x /home/osmc/autosshfs.sh
  20. sudo mkdir /media/osmc/Film
  21. sudo chown osmc /media/osmc/Film
  22. sudo apt-get install sshfs
  23. ###################
  24. sudo nano /lib/systemd/system/autosshfs.service
  25. [Unit]
  26. Description=Mount SSHFS from NAS
  27.  
  28. [Service]
  29. User=osmc
  30. ExecStart=/home/osmc/autosshfs.sh
  31. Type=forking
  32. StandardOutput=null
  33.  
  34. [Install]
  35. WantedBy=multi-user.target
  36. Alias=autosshfs.service
RAW Paste Data