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

  • Author

Ah, brilliant! Don't know anything about Python so don't suppose you could point me in the right direction? :)

I'm doing this by memory but something like that, just add a if to check if the ip is the fake one and then change it for the static ip you want.

 

hope you get the idea.

 

def discoverSleepProxies(interface):
# discover all available Sleep Proxy Servers

proxies = []
cmd = "avahi-browse --resolve --parsable --no-db-lookup --terminate _sleep-proxy._udp 2>/dev/null | grep '=;.*;IPv4;'"

p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
		lineArr = line.rsplit(";")

		# check length
		if (len(lineArr) < 10) :
			p.terminate()
			break

		ip = lineArr[7]
                                            if (ip == "your fake ip"):
                                                  ip= "your ip"
		port = lineArr[8]
		proxies.append({ "ip" : ip, "port" : port})

retval = p.wait()
return proxies

main()

  • Author

Thank you very much, I'll have a play around when I get home tonight!

  • 2 weeks later...
  • Author

Thank you very much Nimrodel that seemed to work a treat! Been busy at work so haven't been able to play around much but now I seem to have the issue where it works as advertised once ie run the script on sleep, services stay advertised and server wakes when accessed... However now if the server sleeps a second time it doesn't seem to keep the services advertised :/

  • 1 month later...

I think finaly I got a solution using the script from https://github.com/awein/SleepProxyClient without any modification.

 

First we need to install this packages:

 

openssl-1.0.1c-i486-3.txz

python-2.7.3-i486-2.txz

python-netifaces-0.8-i486-1alien.tgz

dnspython-1.10.0-i486-1alien.tgz

 

they can be download from:

 

http://slackware.cs.utah.edu/pub/slackware/slackware-14.0/slackware/

http://www.slackware.com/~alien/slackbuilds/

 

then we have to install manually this other package:

 

IPy-0.75.tar.gz

 

it is easy, once it is uncompressed on the pen drive the only thing you need to write on the go files is:

 

cd IPy-0.75

phyton setup.py install

 

That make the original script work, but it still take the wrong ip for my sleep proxy, for that I found a way to cheat the system, adding this routes to the go file seems to help.

 

route add default dev eth0 metric 99

route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99

 

my sleep proxy is working since last thursday with out any problem.

 

 

  • Author

Thanks for posting Nimrodel!

 

Been playing with this for hours now and its giving me headaches!

 

Installed al the packages ( which was an issue due to some of the plugins i run :/) Then it still couldnt register with the sleep proxy even after your additions to the go file. That i think was due to me having IPMI and remote management on the board. I think i got around it by hard coding my IP address into the script...

 

But now whenever I try and run the script my server locks and needs hard restarting. Arrrgh!

  • 1 month later...

Hi,

 

I am the author of SleepProxyClient (https://github.com/awein/SleepProxyClient) and it's great to see the script is running fine on Slackware.

I discovered this thread while searching the web to find a fix for a recently reported issue (https://github.com/awein/SleepProxyClient/issues/5).

Several users reported the same issue here: SPC had chosen the "wrong" IP (169.254...).

 

Good news: This issue should be fixed now!

I removed the dependency to IPy too (which seems to be not available as a Slackware package)

 

The project will get some little updates and cleanups next year.

Please feel free to contribute to the project - just fork the code on Github and submit pull requests.

It would be great to have Slackware-packaging too.

 

  • Author

Awesome news about IPy... I kinda gave up what with the IP Address issue and plus I think another plugin was cause sleep issues. Ill give it another go tonight!

  • 6 months later...

@awein when the system is waked up from a windows the machine name can't be registered with avahi and create a new name with the #2 at the end.

 

Do you know if after the machine is waked up we need to unregistered from the sleep proxy?

 

Thanks

@awein when the system is waked up from a windows the machine name can't be registered with avahi and create a new name with the #2 at the end.

 

Do you know if after the machine is waked up we need to unregistered from the sleep proxy?

 

Thanks

 

Sorry - I don't understand you question. Please describe you problem and setup i more detail.

I have a mixed windows and Mac system, normally if no windows is involved everything seems to work nicely, but when the windows send a wol packet to wake up the system (not using the sleep proxy server) the system is not able to register because the sleep proxy still thinks the machine is sleeping and the avahi registers my server as a new server adding a number at the end.

 

For me it seems that the sleep proxy is no releasing the services or the name if I wake the system on a different way .

 

Does it make sense?

 

Thanks for your help

I have a mixed windows and Mac system, normally if no windows is involved everything seems to work nicely, but when the windows send a wol packet to wake up the system (not using the sleep proxy server) the system is not able to register because the sleep proxy still thinks the machine is sleeping and the avahi registers my server as a new server adding a number at the end.

 

Restarting avahi after each wakeup should resolve this issue.

Ok thanks I will try this,

 

is it also good doing this before sleep?

 

 

Ok thanks I will try this,

 

is it also good doing this before sleep?

 

I've done that on Debian to ensure all services are announced prior to fetching and registering them ... but it should not be necessary...

Hi I keep having this on the log when I resume from sleep, I'm doing the avahidaemon restart.

 

 

Jul  2 21:25:37 UnRaid avahi-daemon[16749]: Server startup complete. Host name is UnRaid.local. Local service cookie is 369886240.
Jul  2 21:25:37 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:25:38 UnRaid avahi-daemon[16749]: Service "UnRaid-SMB" (/services/smb.service) successfully established.
Jul  2 21:25:38 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:25:39 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:25:41 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:27:47 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:27:47 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:27:50 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:27:51 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:27:55 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:27:56 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:28:16 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:28:17 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:35:28 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:35:29 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:37:47 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:37:48 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.
Jul  2 21:37:56 UnRaid avahi-daemon[16749]: Service name conflict for "%h" (/services/afp.service), retrying with "UnRaid #2".
Jul  2 21:37:57 UnRaid avahi-daemon[16749]: Service "UnRaid" (/services/afp.service) successfully established.

 

any clue?

 

thanks.

any clue?

 

Sorry - SPC has currently no de-registration code. Maybe stopping and waiting some time may help...

It would be interesting to take a look at the remaining TTL for the old records. (But getting these is not that easy)

 

But you may avoid waking the host via WOL directly... Just simulate a access to any of the announced services. (A connect to one of the announced ports should be enough).

Thanks, I will try that.

New question, if I bond two network cards does the script should handle that right? Or do I must change something?

 

Thanks

Multiple interfaces should be no problem. (Please report an issue if there are problems)

  • 2 years later...

Anyone using this successfully in unRAID v6?

Answering my own question. :)

 

I installed these packages to my unRAID 6.1.6 server. (Copy them to /boot/extra and reboot or use installpkg command):

 

python-2.7.11-x86_64-1

python-netifaces-0.8-x86_64-1alien

dnspython-1.10.0-x86_64-1alien

openssl-1.0.2e-x86_64-1

 

..then got the latest version of Sleep Proxy Client from https://github.com/awein/SleepProxyClient and copied it to the flash drive. Since I'm using the Dynamix S3 Sleep plugin, I added the following to Custom commands before sleep: in Sleep Settings

 

python /boot/wherever/you/put/yours/sleepproxyclient.py --interface br0

Now when my unRAID server goes to sleep, the Airport Express on my network registers the smb, afp, sftp, ssh services for my unRAID server. For example if I try to establish an ssh connection to my server, it wakes up. Or if I try connecting to any of my SMB shares, it wakes up. Great for file services etc...

 

But...

Unfortunately any of the services that are running under docker does not register with the Sleep Proxy this way. When I run sleepproxyclient.py --debug, I don't see any of the docker services as advertised..

 

I'd love to be able to have at least my PlexMediaServer docker register its services so that any attempt to connect to the PMS when unRAID is sleeping would wake it up.

 

Any ideas as to how I should go about enabling dockerized apps to register using SleepProxyClient?

Figured out how to get your Plex Media Server or any other service for that matter to be advertised by avahi.

 

Create a plex.service file

 

<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Plex on %h</name>
<service>
        <type>_plexmediasvr._tcp</type>
        <port>32400</port>
</service>
</service-group>

 

Then copy it to /etc/avahi/services/ at boot. A line like this in your go file would do the trick:

 

# Add Custom Avahi Services
cp /boot/custom/avahi/plex.service /etc/avahi/services/

  • 6 years later...

Just stumbled across this old solution to get wake-on-demand working, but sadly the python script isn't working for me.

 

Already figured out the problem. The script won't get any discovered services. When running avahi-browse -a I'm also not able to see my unraid services (smb, ssh, sftp).

 

But when I run avahi-browse on my raspberry pi, the unraid services are visible. So it seems they are getting published correctly, but my unraid server won't recognise them using the avahi-browse command, which is necessary for the python script to do its thing...

 

But I have absolutely no idea what could cause this problem :(

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.