Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #ping server ip in case its already up
- ping -c 1 -w 1 -q SERVERIP > /dev/null
- status=$?
- logger "AUTOFS: Attempting to mount $1 filesystem from SERVERIP"
- logger "AUTOFS: Result from ping - $status"
- if [ $status -ne 0 ]
- then
- logger "AUTOFS: Host is not up. Sending wake-on-lan"
- /usr/sbin/etherwake SERVERMAC
- logger "AUTOFS: Sleeping for 5 seconds to allow host to wake"
- sleep 5
- fi
- logger "AUTOFS: Re-pinging host"
- ping -c 1 -w 1 -q SERVERIP > /dev/null
- status=$?
- logger "AUTOFS: Result - $status"
- if [ $status -eq 0 ]
- then
- logger "AUTOFS: Mounting $1 filesystem"
- #echo out autofs settings. Mount $1 share. $1 is passed in by autofs
- /bin/echo -n "-fstype=smbfs,rw,username=user,password=password ://SERVERIP/$1"
- wget --delete-after "http://httpuser:httppass@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(Erfolgreich,NAS%20wurde%20geweckt))"
- else
- logger "AUTOFS: Still no ping result from host"
- 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