April 25, 201214 yr Can someone help with a WOL Plugin, would be a nice to have. Does Unraid have WOL support
April 25, 201214 yr Are you wanting your unRAID server to wake up other machines or be woken up by other machines. If it's the latter, there are scripts available on this site and in the Wiki to put your unRAID server to sleep when there's no activity. Check here for more info. If it's the former, there are scripts available that will wake up other machines. Here's a Python one I use on my main server (to wake my unRAID server up before starting a backup). I can't remember where I got it from. exec /usr/bin/python -x "$0" "$@" # -*- coding: ISO-8859-15 -*- # # wake-on-lan # $Id: wake-on-lan.cin,v 1.0 2010/02/20 15:05:42 das Exp $ # S. Das, London ## --- Local nodes -------------------------- ## ## Modify this to put your own hostname/MAC ## address pair here. The format is: ## "abc xx:xx:xx:xx:xx:xx", where "abc" could ## be any name you like and the "xx:xx..." is ## the MAC address of the machine the magic ## packet is going to be sent. node_lst = [ 'tower XX:XX:XX:XX:XX:XX', ] ## --- don't change anything below --------- ## import os,sys,string,commands import struct, socket import re,random retval = 0 X = '([a-fA-F0-9]{2}[\-|.]?){5}[a-fA-F0-9]{2}$' S = re.compile(r'\s+') E = re.compile('^$') mmap = {} ## First argument 'None' in str.translate is new in 2.6. ## Previously, it was a string of 256 characters. if sys.version_info < (2, 6): f1_arg = ''.join(chr(i) for i in xrange(256)) else: f1_arg = None def WakeOnLan(mac_address): ## Building the Wake-On-LAN "Magic Packet"... ## Pad the synchronization stream. data = ''.join(['FFFFFFFFFFFF', mac_address * 20]) msg = '' ## Split up the hex values and pack. for i in range(0, len(data), 2): msg = ''.join([msg, struct.pack('B', int(data[i: i + 2], 16))]) ## ...and send it to the broadcast address using UDP s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.sendto(msg, ('255.255.255.255', 9)) s.close() def sys_exit(): sys.stdout.flush() sys.exit(1) ## check if hostname is provided if len(sys.argv) != 2: print "Usage: %s <hostname>" % sys.argv[0] sys_exit() for i in node_lst: # strip off everything from first "#" found i = i.split('#',1)[0] if E.match(i): continue h = S.split(i,1)[0] ## host name m = S.split(i,1)[-1] ## MAC address mmap[h] = m.strip('\t|" "') for j, k in mmap.iteritems(): if sys.argv[1] == j: if not re.search(X, k): print "Invalid MAC address [",k,"]; nothing to do!!" sys_exit() else: WakeOnLan(k.translate(f1_arg,':.-')) print "WOL request has been sent to %s [%s]" % (j,k) break else: print "Host [%s] doesn't exist!!" % sys.argv[1] sys_exit()
April 25, 201214 yr Author awesome, I want to wake other servers up, I am going to see if I can create a plugin for this thanks
May 14, 201214 yr Author using the above script thanks to Flibblebot I amended it a bit to accept a mac-address as a parameter to WOL a server, I then tried to create a php forms page which would allow you capture hostnames and mac-addresses, what I didn't get right is when I added a WAKE button next to each entry and the onclick=exec(./boot/config/plugins/wol/wol.py $param) doesn't can seem to get it to exec the python script. anyone will to help out here ?
Archived
This topic is now archived and is closed to further replies.