Ansluter till utdelningarna på min lokala NAS med autofs
Funkar fint, men inte om NASen är i vila. Någon som har en bra lösning för det här problemet?
Har provat den här guiden utan lyckat resultat. Och den här.
Längst kom jag med den här guiden:
#!/bin/bash
#ping server ip in case its already up
ping -c 1 -t 1 -q 192.168.0.40 > /dev/null
status=$?
logger "AUTOFS: Attempting to mount $1 filesystem from 192.168.0.40"
logger "AUTOFS: Result from ping - $status"
if [ $status -ne 0 ]
then
logger "AUTOFS: Host is not up. Sending wake-on-lan"
/usr/local/Cellar/wakeonlan/0.41/bin/wakeonlan XX:XX:XX:XX:XX:92
logger "AUTOFS: Sleeping for 10 seconds to allow host to wake"
sleep 10
fi
logger "AUTOFS: Re-pinging host"
ping -c 1 -t 1 -q 192.168.0.40 > /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
echo -n -fstype=afp afp://username:[email protected]/$1"
else
logger "AUTOFS: Still no ping result from host..."
Om NASen vilar så kickar den igång, men ingen montering sker. Jag får följande i loggen:
AUTOFS: Attempting to mount Multimedia filesystem from 192.168.0.40
AUTOFS: Result from ping - 2
AUTOFS: Host is not up. Sending wake-on-lan
AUTOFS: Sleeping for 10 seconds to allow host to wake
AUTOFS: Re-pinging host
AUTOFS: Result - 2
AUTOFS: Attempting to mount Multimedia filesystem from 192.168.0.40
AUTOFS: Result from ping - 2
AUTOFS: Host is not up. Sending wake-on-lan
AUTOFS: Sleeping for 10 seconds to allow host to wake
AUTOFS: Re-pinging host
AUTOFS: Result - 0
AUTOFS: Attempting to mount Multimedia filesystem from 192.168.0.40
AUTOFS: Result from ping - 0
AUTOFS: Re-pinging host
AUTOFS: Result - 0