[Resolved] How can i use FOG WOL in python3 script
i would like to use FOG WOL to wake up computers with my ics file.
FOG don’t do that and i want script this if it’s possible.
If you have idea to do that with python3
@Crok Ok, now I got you. Unfortunately I won’t have enough time to come up with a solution to that. So you need to try it yourself. To get back to the initial request, a quick search on the web revealed many projects/libs/… that do wake on lan in python:
So it’s just a matter of getting into coding and get it done. This has nothing much to do with what we can do for you as a FOG team.
I have an organizer that define when computers are used.
Monday -> my computer must be wake up at 10Am
Next monday -> at 8am
All wake up are differents for each computers and each days.
My organizer (calendar) is an .ics file can extract.
i would like use this ics file to wake up my computers automatically.
my ics file must be modified, i do extract each hour.
Sorry my english is so bad.
i hope that is more clearly.
@Crok I am still not exactly sure what you are trying to do. It sounds like you want to send WOL to clients on a regular basis, e.g. hourly?!
If that is what you want, then FOG should be able to do this for you. Select one host in the webUI -> Basic Tasks -> Advanced -> Wake-Up -> Schedule cron-style -> select “Hourly” from the list
Re-reading some of your other posts I get the impression that this is not what you want. So please tell us more about where this mysterious “ics file” is coming from. What is generating this and how? On what basis?
The PERL script you posted might work but there are ready to use Linux tools to send WOL packets as well. Look into packages called
wakeonlan. That’s Debian/Ubuntu and I am sure you find those in CentOS/Fedora as well if you are using one of those.
i see you use a script perl to wol computers
# Written by Marc Balmer, firstname.lastname@example.org, http://www.msys.ch/ # This code is free software under the GPL import struct, socket def WakeOnLan(ethernet_address): # Construct a six-byte hardware address addr_byte = ethernet_address.split(':') hw_addr = struct.pack('BBBBBB', int(addr_byte, 16), int(addr_byte, 16), int(addr_byte, 16), int(addr_byte, 16), int(addr_byte, 16), int(addr_byte, 16)) # Build the Wake-On-LAN "Magic Packet"... msg = b'\xff' * 6 + hw_addr * 16 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.sendto(msg, ('126.96.36.199', 9)) s.close() # saisir l'adresse MAC de la machine WakeOnLan('00:11:22:33:44:55')
I try with this script.
i can use a ics file with “timetable”.
At each hour, i want wake up PC in term of ics file.
My file must be modified, is that reason i download my ics file at each hour and if my computer must wake up, i want use FOG WOL for this or a magic packet in my python3 script.