• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

[Resolved] How can i use FOG WOL in python3 script

Scheduled Pinned Locked Moved
General Problems
2
7
981
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    Crok
    last edited by Crok Mar 13, 2019, 6:10 AM Sep 14, 2018, 2:26 PM

    Hello,
    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 🙂

    thxs

    1 Reply Last reply Reply Quote 0
    • S
      Sebastian Roth Moderator
      last edited by Sep 14, 2018, 3:44 PM

      @Crok said in How can i use FOG WOL in python3 script:

      wake up computers with my ics file.

      What exactly do you mean by that?

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      1 Reply Last reply Reply Quote 0
      • C
        Crok
        last edited by Sep 17, 2018, 7:40 AM

        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.

        1 Reply Last reply Reply Quote 0
        • C
          Crok
          last edited by Sep 18, 2018, 6:29 AM

          i see you use a script perl to wol computers
          https://wiki.fogproject.org/wiki/index.php?title=How_to_use_the_wakeonlan_perl_script_instead_of_etherwake.exe

          # Written by Marc Balmer, marc@msys.ch, 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[0], 16),
              int(addr_byte[1], 16),
              int(addr_byte[2], 16),
              int(addr_byte[3], 16),
              int(addr_byte[4], 16),
              int(addr_byte[5], 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, ('1.2.3.255', 9))
            s.close()
          
          # saisir l'adresse MAC de la machine
          WakeOnLan('00:11:22:33:44:55')
          
          

          I try with this script.

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Sebastian Roth Sep 18, 2018, 2:46 AM Sep 18, 2018, 8:44 AM

            @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 etherwake and wakeonlan. That’s Debian/Ubuntu and I am sure you find those in CentOS/Fedora as well if you are using one of those.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            C 1 Reply Last reply Sep 18, 2018, 12:41 PM Reply Quote 0
            • C
              Crok @Sebastian Roth
              last edited by Crok Sep 18, 2018, 6:42 AM Sep 18, 2018, 12:41 PM

              @Sebastian-Roth
              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.
              https://fr.wikipedia.org/wiki/ICalendar
              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.

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Sep 18, 2018, 5:36 PM

                @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:
                https://pypi.org/project/wakeonlan/
                https://github.com/bentasker/Wake-On-Lan-Python
                https://gist.github.com/rschuetzler/8854764

                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.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  7/7
                  Last post

                166

                Online

                12.0k

                Users

                17.3k

                Topics

                155.2k

                Posts
                Copyright © 2012-2024 FOG Project