windows - Automatically Wake NAS on Access -


i'm trying nas server wake s3 sleep state when nas accessed user. want increase longevity of server, , limit power usage. i've seen people asking similar advice none found provide robust solution, threads ended unanswered.

so detail problem quickly: @ home have custom built, old pc, nas server, running ubuntu server, stores media , documents mainly. server set sleep after predefined inactive period. nas can brought out of s3 state wol magic packet. achieve magic packet automatically sent server when user accesses 1 of shares pc. users running windows 7. i'm not sure if entirely prevalent have linksys wrt54g running dd-wrt home router/dhcp/dns.

during research came across many articles automatically woke server on timed loop, no real intelligence. article given below seems want:

http://wdtvhd.com/index.php?showtopic=7908

a script given attempts address problem using dd-wrt router send wake-on-lan packets when query made. seems way go this, not script given in link operate correctly.

i think covers aspects of problem. assistance appreciated.

just thought post eventual solution above mentioned problem. solve problem wrote custom script runs on dd-wrt router on timed cron job. when script runs access file

\proc\net\arp 

within in file stored record of leased ip address , corresponding mac addresses. script compared mac addresses stored within file predefined list of mac address of pcs on home network. list comprised of pcs able access nas server. if 1 of pcs found have active lease router sends wake-on-lan magic packet. wakes server. @ point thought had achieved goal, server switched on of pcs on network, , wait not long. however, after completing found timed sleep server initiate every 30 min or , sleep server woken again couples of seconds later.

so solve issue added condition conditional statement sleep server if none of required pc had active lease. used ssh , built in dropbear ssh functionality of dd-wrt sleep server. below script

#!/bin/ash  nas="ma:ca:dd:re:ss:00"  pc="ma:ca:dd:re:ss:00"  varp='grep -o $pc /proc/net/arp'  while true     echo 'entered loop'     if ping -c 1 ipaddressofnas > /dev/null;             echo 'nas on'      if [[ "$varp" != "ma:ca:dd:re:ss:00" ]];                     echo 'all hosts offline'                     echo ipaddressofnas  ssh-rsa naspuplickey                     #home=/temp/root/                     dropbear_password='naspassword' ssh root@ipaddressofnas pm-suspend &             fi             exit     fi      if [[ "$varp" == "ma:ca:dd:re:ss:00" ]];             echo 'waking lan'             /usr/sbin/wol -i broadcastaddressofnetork -p 9 ma:ca:dd:re:ss:00             /usr/sbin/wol -i broadcastaddressofnetork  -p 9 ma:ca:dd:re:ss:00             exit     fi     exit done 

disclamer: code supplied is. aware not pretty nor best solution possible. works me , thats need.

hope finds useful!


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -