Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Apple Bonjour Sleep Proxy Client Implementation (Wake on Demand)

Featured Replies

Dear All,

 

Ever since I decided to build my unRAID server, I have looked into the possibility of somehow allowing my unRAID box to wake from sleep when accessed. After trawling the internet and not really finding anything helpful, I came across the phrase 'Wake On Demand'. This, it seemed, was exactly what I was looking for. However, this turned out to be a phrase for an Apple specific implementation known as Bonjour Sleep Proxy. This, simply put, allows for a computer to register its bonjour / Avahi services with a proxy right before going to sleep. The proxy then keeps these services visible and 'Alive' on the network until someone or something tried to access them. It then sends a WOL packet to wake up the sleeping computer, and then passes the request onto the now awake computer.

 

What is required is for the device, typically an Apple device, is to register itself. This is where until recently I'd hit a deadend for any Linux based OS. Until I found this Debian / Ubuntu implementation :

 

https://github.com/awein/SleepProxyClient

 

Would anybody out there be willing to port this, or at least give me some guidance so I can attempt it myself?!

 

IF it is possible I think it would be hugely beneficial to any of the thousands of unRAID users out here who would like ths Wake On Demand feature!!

 

Please leave any feedbak, good or bad!!

 

Alex

I have this working on my unRAID server using my AppleTV as the Sleep proxy. I'll try to get it packaged and posted tomorrow.

 

Greg

 

 

Sent from my iPhone using Tapatalk

  • Author

That would be brilliant if you could! Cheers mate!

I have following scrip, bur not tested yet, is this what you looking for?

 

#!/usr/bin/perl
#--------------------------------------------------------------#
# AutoFS executable map to wake server when accessing a share. #
#                                                              #
# When a share is accessed we check to see if the server is    #
# awake and if not then a magic packet is sent to wake it up.  #
# The share is mounted when a successful ping response is      #
# received from the server.                                    #
#                                                              #
# Quick Setup:                                                 #
#                                                              #
# 1. Set the values below to match your unRAID setup for       #
#    $host, $hwaddr, @shares, $user and $passwd                #
#                                                              #
# 2. Copy to /etc and set execute bit                          #
#    sudo cp auto_unraid /etc                                  #
#    sudo chmod +x /etc/auto_unraid                            #
#                                                              #
# 3. Add the following line to /etc/auto_master                #
#    /Volumes/unraid       auto_unraid                         #
#                                                              #
# 4. Load your changes                                         #
#    sudo automount -vc                                        #
#                                                              #
#--------------------------------------------------------------#
use strict;

# hostname or IP of unRAID server
my $host   = '192.168.1.100';

# MAC Address for unRAID server
my $hwaddr = 'XX:XX:XX:XX:XX:XX';

# array of AFP share names
my @shares = ("Documents","Development","Movies","TimeMachine");

# username and password for mounting shares
# set to empty string if not needed
my $user   = '';
my $passwd = '';


# =============================================================
# You should not need to modify anything below this point
# =============================================================

if (@ARGV == 0) {
    print join("\n", @shares)."\n";
    exit;
}

my $is_asleep = "ping -c1 -t1 ".$host." >/dev/null 2>&1";
system($is_asleep);
if ($? != 0) {
    use Socket;
    my $port        = getservbyname('discard', 'udp');
    my $hostaddr    = gethostbyname('255.255.255.255');
    my $sockaddr_in = pack_sockaddr_in($port, $hostaddr);
    my $proto       = getprotobyname('udp');
    my $pkt         = chr(0xFF) x 6 . join("", map {chr(hex($_))} split(/:/,$hwaddr)) x 16;
    my $count       = 0;
    socket(S, AF_INET, SOCK_DGRAM, $proto);
    setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1);
    send(S, $pkt, 0, $sockaddr_in);
    do {
        $count++;
        system($is_asleep);
    } while ($? != 0 && $count < 15);
}

if ($user && $passwd) {
    print "-fstype=afp afp://".$user.":".$passwd."@".$host."/".$ARGV[0]."\n";
} else {
    print "-fstype=afp afp://".$host."/".$ARGV[0]."\n";
}

exit;

  • Author

@peter_sm

 

Thanks for your post, but I think not. If I understand correctly, and please correct me if I'm wrong, your script is for a linux based client which if it cannot contact the unRAID server, it will send a magic packet to wake it up?

 

The pro's of registering with the sleep proxy is it is not OS dependant, or even reliant on pre-installed scripts. Any device which tries to access the unRAID share will cause the Sleep Proxy device, be it a ATV2/3 in the above usage, or my Airport Express, will send the WOL magic packet to the unRAID server.

 

All that is required is for the unRAID server to register itself, which hopefully the package Greg is using will do!

I have not had time to work on this yet, but I have not forgotten about it

 

Greg

 

 

Sent from my iPhone using Tapatalk

  • Author

Greg,

 

Thanks for letting me know! Was just logging on to ask! Haha. Thanks again!

 

Alex

I'm interested as well.

  • Author

Definitely leaving this one with you Greg... Just spent the last two hours trying to get python to compile ( don't know why it wouldn't, I've done it before!!) and also trying to find a slackware package for netifaces...

 

Failed miserably on both!! Haha

I was finally able to work on this today. The only package that's needed is the pythondns.

I'll post a modified script you can test tomorrow morning

 

Greg

 

 

Sent from my iPhone using Tapatalk

  • Author

Hahaha! Two hours of my life I'll never get back! ::)

 

That would be brilliant mate, thanks again for your time!

 

Alex

ok, finally had time to test and work out issues, but not to package it all up.

 

I'll post everything here and you can test while I try to find the time to put it together in a package.

 

For this to work you'll need python-2.6.6-i486-1.txz which you probably already have, and dnspython-1.8.0-i686-3sl.txz which you probably don't have.  You can get these packages here:

http://slackware.cs.utah.edu/pub/slackware/slackware-13.37/slackware/d/python-2.6.6-i486-1.txz

http://repository.slacky.eu/slackware-13.37/libraries/dnspython/1.8.0/dnspython-1.8.0-i686-3sl.txz

 

The sleepproxyclient.py python script is here:

sleepproxyclient.zip

 

You'll need to install the two python packages either by putting them in /boot/extra and rebooting or running installpkg python-2.6.6-i486-1.txz and installpkg dnspython-1.8.0-i686-3sl.txz

 

Then you'll need to setup the sleepproxyclient.py to be executed prior to sleep, you can do this by editing your sleep script and adding it before the "echo -n mem >/sys/power/state" command; or if you are using the SimpleFeatures Sleep plugin you can add it to the settings.

 

command line for sleepproxyclient.py needs to be in this format:

 

/path/where/you/put/the/script/sleepproxyclient.py eth0 192.168.1.100 xx:xx:xx:xx:xx:xx

 

replace the args with your interface ipaddress hwaddress

 

 

Right now this is all manual but I'll put it together in a plugin as soon as I get the time.

 

I updated the simpleFeatures webGUI and Sleep plugins so the SimpleFeatures Sleep plugin is used by the Sleep button on the Main page, if you want this feature you can get the modified plugins here:

 

http://www.walnuthead.com/unraid/simpleFeatures-v1.0rc2-base-webGUI-walnuthead.tgz

http://www.walnuthead.com/unraid/simpleFeatures-v1.0rc2-s3-sleep-addon-walnuthead.tgz

 

 

Greg

 

 

  • Author

Greg, very much appreciated you taking the time to post the walk through for installing your script!

 

However.com, All bonjour advertised services from my unRAID box are dying 30-40 seconds after the box has gone to sleep :/.

 

Its been a very quick trial as I only have an hour before starting work, however this is where I'm at so far...

 

Copied the required packaged both PythonDNS and Python to /boot/extras and installed without reboot.

 

Installed your script to /boot/scripts/.

 

Installed your modified WebGUI and S3Sleep addon.

 

Added the script call line to the Sleep Settings with eth0 <myip> and <my-unRAID-HW-ADD>.

 

Rebooted.

 

Selected Sleep Now from the WebGUI, sever went to sleep after 5-8 seconds.

 

Tried connecting from my Mac... No connection.

 

Checked Bonjour Browser... Saw services advertised for 30 seconds, then the disappeared.

 

Woke my Server and ran the script from console to see any errors... Saw none.

 

Restarted my Airport Express ( for info the APEx is showing the sleep proxy service on BonjourBrowser)

 

Tried Sleep again, same issues...

 

Wrote this and now heading to work! haha

 

Any ideas?

 

 

UPDATE:

 

Well, I've never looked at a python script in my life never mind debugged one, but i ran :

 

python -m trace --trace /boot/scripts/sleepproxyclient.py eth0 192.168.1.67 00:25:90:38:2d:a4 | grep sleepproxyclient.py > debug.txt

 

I hoped to get an output of where the script is failing, as it brings up no error message or issue when I run it. It seems to end on the "No sleep proxy" arguement, although I can defo confirm there is one showing on the network on my BonjourBrowser.

 

Hope this helps cause I'm way out of my depth! haha

 

sleepproxyclient.py(22): import dns.update
sleepproxyclient.py(23): import dns.query
sleepproxyclient.py(24): import dns.rdtypes
sleepproxyclient.py(25): import dns.rdata
sleepproxyclient.py(26): import dns.edns
sleepproxyclient.py(27): import dns.rrset
sleepproxyclient.py(28): from dns.exception import DNSException
sleepproxyclient.py(30): import struct
sleepproxyclient.py(31): import sys
sleepproxyclient.py(32): import subprocess
sleepproxyclient.py(33): import socket
sleepproxyclient.py(42): DEVICE_MODEL = "unRAID"
sleepproxyclient.py(47): TTL_long = 7200 # 2 h
sleepproxyclient.py(51): TTL_short = 120
sleepproxyclient.py(54): def main() :
sleepproxyclient.py(63): def sendUpdateForInterface(interface) :
sleepproxyclient.py(145): def discoverServices(ip):
sleepproxyclient.py(172): def discoverSleepProxies(interface):
sleepproxyclient.py(194): main()
sleepproxyclient.py(56): 	iface = sys.argv[1]
sleepproxyclient.py(57): 	try:
sleepproxyclient.py(58): 		sendUpdateForInterface(iface)
sleepproxyclient.py(66): 	proxies = discoverSleepProxies(interface)
sleepproxyclient.py(175): 	proxies = []
sleepproxyclient.py(176): 	cmd = "avahi-browse --resolve --parsable --no-db-lookup --terminate _sleep-proxy._udp 2>/dev/null | grep '=;.*;IPv4;'"
sleepproxyclient.py(178): 	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
sleepproxyclient.py(179): 	for line in p.stdout.readlines():
sleepproxyclient.py(180): 			lineArr = line.rsplit(";")
sleepproxyclient.py(183): 			if (len(lineArr) < 10) :
sleepproxyclient.py(187): 			ip = lineArr[7]
sleepproxyclient.py(188): 			port = lineArr[8]
sleepproxyclient.py(189): 			proxies.append({ "ip" : ip, "port" : port})
sleepproxyclient.py(179): 	for line in p.stdout.readlines():
sleepproxyclient.py(191): 	retval = p.wait()
sleepproxyclient.py(192): 	return proxies
sleepproxyclient.py(67): 	if (len(proxies) == 0) :
sleepproxyclient.py(71): 	ip4Addr = sys.argv[2]
sleepproxyclient.py(72): 	hwAddr = sys.argv[3]
sleepproxyclient.py(75): 	ip4Arr = ip4Addr.rsplit(".")
sleepproxyclient.py(76): 	ip4ArrInv = ip4Arr[:]
sleepproxyclient.py(77): 	ip4ArrInv.reverse()
sleepproxyclient.py(78): 	ip4Inv = ".".join(ip4ArrInv)
sleepproxyclient.py(80): 	host = socket.gethostname() 
sleepproxyclient.py(81): 	host_local = host + ".local"
sleepproxyclient.py(84): 	update = dns.update.Update("")
sleepproxyclient.py(87): 	update.add(ip4Inv + '.in-addr.arpa', TTL_short, dns.rdatatype.PTR, host_local)
sleepproxyclient.py(88): 	update.add(host_local, TTL_short, dns.rdatatype.A,  ip4Addr)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(148): 	services = []
sleepproxyclient.py(149): 	cmd = "avahi-browse --all --resolve --parsable --no-db-lookup --terminate 2>/dev/null | grep '=;.*;IPv4;' | grep ';" + ip + ";'"
sleepproxyclient.py(151): 	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(148): 	services = []
sleepproxyclient.py(149): 	cmd = "avahi-browse --all --resolve --parsable --no-db-lookup --terminate 2>/dev/null | grep '=;.*;IPv4;' | grep ';" + ip + ";'"
sleepproxyclient.py(151): 	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(153): 	    lineArr = line.rsplit(";")
sleepproxyclient.py(156): 	    if (len(lineArr) < 10) :
sleepproxyclient.py(161): 	    if (lineArr[7] == ip) :
sleepproxyclient.py(162): 	    	service = lineArr[4]
sleepproxyclient.py(163): 	    	port = lineArr[8]
sleepproxyclient.py(164): 	    	txtRecords = lineArr[9].replace('" "', ';').replace('\n', '').replace('"', '').rsplit(';')
sleepproxyclient.py(165): 	    	services.append([service, port] + txtRecords)
sleepproxyclient.py(152): 	for line in p.stdout.readlines():
sleepproxyclient.py(167): 	retval = p.wait()
sleepproxyclient.py(168): 	return services
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[i]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[i]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[i]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(99): 			txtrecord = chr(0)
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(99): 			txtrecord = chr(0)
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(99): 			txtrecord = chr(0)
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[ i ]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[i]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(92): 		type = service[0] + ".local"
sleepproxyclient.py(93): 		type_host = host + "." + type
sleepproxyclient.py(94): 		port = service[1]
sleepproxyclient.py(97): 	 	txtrecord = ""
sleepproxyclient.py(98): 		if (len(service) == 2 or service[2] == "") : 
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(102): 					txtrecord += " " + service[i]					
sleepproxyclient.py(101): 			for i in range(2,len(service)) :
sleepproxyclient.py(104): 		update.add(type_host, TTL_long, dns.rdatatype.TXT, txtrecord)
sleepproxyclient.py(105): 		update.add('_services._dns-sd._udp.local', TTL_long, dns.rdatatype.PTR, type + ".local")
sleepproxyclient.py(106): 		update.add(type, TTL_long, dns.rdatatype.PTR, type_host)
sleepproxyclient.py(107): 		update.add(type_host, TTL_short, dns.rdatatype.SRV, "0 0 " + port + " " + host_local)
sleepproxyclient.py(91): 	for service in discoverServices(ip4Addr) :
sleepproxyclient.py(111): 	update.add(host + '._device-info._tcp.local.', TTL_long, dns.rdatatype.TXT, "model=" + DEVICE_MODEL + " state=sleeping")
sleepproxyclient.py(117): 	leaseTimeOption = dns.edns.GenericOption(2, struct.pack("!L", 7200))
sleepproxyclient.py(121): 	cleanMAC = hwAddr.replace(":", "")
sleepproxyclient.py(122): 	ownerOption = dns.edns.GenericOption(4, ("0000" + cleanMAC).decode('hex_codec'))
sleepproxyclient.py(127): 	update.use_edns(0, TTL_long, 1440, None, [leaseTimeOption, ownerOption])
sleepproxyclient.py(130): 	for proxy in proxies :
sleepproxyclient.py(131): 		try:
sleepproxyclient.py(132): 			errStr = "Unable to register with SleepProxy " + proxy['ip'] + ":" + proxy['port']
sleepproxyclient.py(134): 			response = dns.query.udp(update, proxy['ip'], timeout=10, port=int(proxy['port']))
sleepproxyclient.py(140): 		except DNSException, e:
sleepproxyclient.py(141): 			print e
sleepproxyclient.py(130): 	for proxy in proxies :

  • 2 weeks later...
  • Author

Can anybody send some help this way?!? :)

run this command on your unRAID server, it is the command used in the script to detect the sleep proxy

 

avahi-browse --resolve --parsable --no-db-lookup --terminate _sleep-proxy._udp

 

Does that list your sleep proxy?

  • Author

Cheers for that Greg... I'm at work at minute but I'll try when I finish and let you know!

 

Alex

  • Author

Run that command Greg and it it detected it :

 

+;eth0;IPv4;50-35-10-70\032Alex\039s\032AirPort\032Express;_sleep-proxy._udp;local
=;eth0;IPv4;50-35-10-70\032Alex\039s\032AirPort\032Express;_sleep-proxy._udp;local;Alexs-AirPort-Express.local;169.254.85.73;63516

[quote name="alxscott" post="192850" timestamp="1343505044"]
=;eth0;IPv4;50-35-10-70\032Alex\039s\032AirPort\032Express;_sleep-proxy._udp;local;Alexs-AirPort-Express.local;169.254.85.73;63516

 

This shows your airport express with a link-local or self assigned ip address of "169.254.85.73" why is this?  Are you intentionally using that address for some reason or is there a problem on your router.  I would recommend against using  169.254.*.* IP addresses if this was by choice.

 

First thing I would recommend is fixing the issue with the airport express ip address.

 

 

 

 

  • Author

Firstly Greg just want to say really appreciate the time your taking with helping me our here! Really good of you!

 

Reference the link local IP allocation : I havent manually set this IP address for my Airport Express. From reading an apple Support document I think the ApEx advertises itself on two addresses, one of which being a link local address so it can always be found via the configuration utility even if there is a net woprk connectivity issue. Below is a screen shot from the Apple Airport Config utility; showing a "normal" network address and a link-local address.

 

I have also configured my network router to assign the Airport Express a static IP address.

 

I restarted my ApEx and my router, ran the above command again and it came back with the same results ie only the link local IP address. I pinged the 192.168.xxx.xxx IP address which the config utility was listing from my unRAID box and it pinged it no problem, its just not detecting it.

 

Dont know if it is of relevance however, I'm not using my ApEx as a access point or anything, its on my network purely for streaming music to another room, and hopefully as acting as a sleep proxy sever!

 

Thanks again for looking at this... Im off to work again!

 

photo_2.PNG.14980b2e5f03992d5f1b4b0e6b2c5c26.PNG

  • 2 weeks later...

hi Greg

 

had any time to make that package ?

 

would be interested in this too to start my unraid when the kid is using plex

 

from all other boxes i installed the wol xbmc addon as we most of the time use xbmc but the kid likes plex more

 

 

  • 1 month later...
  • Author

Any news on a possible package Greg?!

 

Sorry, but I have not had time to work on it

 

 

Sent from my iPhone using Tapatalk

  • Author

No worrys Greg, that's for all your help anyway!  :)

 

I haven't had time either till recently and I'm still having the link local issues!!

Anybody out there got any suggestions? I'm thinking it has something to do with my ApEx configuration...

With my Timecapsule it happens the same not detecting the right IP, So I decided to change the script to use the ip manualy, so when detects the wrong IP I replaced by the timecapsule static ip.

Seems to work.

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.