Advertisement
Guest User

Untitled

a guest
Mar 26th, 2012
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #ping server ip in case its already up
  4. ping -c 1 -w 1 -q SERVERIP > /dev/null
  5. status=$?
  6. logger "AUTOFS: Attempting to mount $1 filesystem from SERVERIP"
  7. logger "AUTOFS: Result from ping - $status"
  8. if [ $status -ne 0 ]
  9. then
  10. logger "AUTOFS: Host is not up. Sending wake-on-lan"
  11. /usr/sbin/etherwake SERVERMAC
  12. logger "AUTOFS: Sleeping for 5 seconds to allow host to wake"
  13. sleep 5
  14. fi
  15.  
  16. logger "AUTOFS: Re-pinging host"
  17. ping -c 1 -w 1 -q SERVERIP > /dev/null
  18. status=$?
  19. logger "AUTOFS: Result - $status"
  20.  
  21. if [ $status -eq 0 ]
  22. then
  23. logger "AUTOFS: Mounting $1 filesystem"
  24. #echo out autofs settings. Mount $1 share. $1 is passed in by autofs
  25. /bin/echo -n "-fstype=smbfs,rw,username=user,password=password ://SERVERIP/$1"
  26. wget --delete-after "http://httpuser:httppass@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(Erfolgreich,NAS%20wurde%20geweckt))"
  27. else
  28. logger "AUTOFS: Still no ping result from host"
  29. wget --delete-after "http://httpuser:httppass@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(Fehlgeschlagen,Nas%20konnte%20nicht%20geweckt%20werden))"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement