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

    Solved Scheduled Wake On Lan

    FOG Problems
    4
    17
    434
    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.
    • P
      Petěrko last edited by Petěrko

      Hallo all!

      OS: Debian 10. Fresh install.
      FOG: 1.5.9. (tried dev branch 1.5.9.65 too).

      I can not make Scheduled WOL work. Wake on Lan via Power Management option “Perform Immediately” is working perfectly. Tried group/host tasks, tried power management, Wake-up task…

      File /opt/fog/log/fogscheduler.log shows:

      For Power Management Cron task:

      [04-21-21 1:04:12 pm]  * 1 task found.
      [04-21-21 1:04:12 pm]  * Task run time: Wed, 21 Apr 2021 13:04:00 +0200
      [04-21-21 1:04:12 pm]  * Found a wake on lan task that should run.
      [04-21-21 1:04:12 pm]  | Task sent to XXXXX
      

      For Wake-up Task:

      [04-21-21 1:06:12 pm]  * 1 task found.
      [04-21-21 1:06:12 pm]  * Task run time: Wed, 21 Apr 2021 13:06:00 +0200
      [04-21-21 1:06:12 pm]  * Found a task that should run.
      [04-21-21 1:06:12 pm]            - Is a host based task.
      [04-21-21 1:06:12 pm]            - Unicast task found!
      [04-21-21 1:06:12 pm]            - Host XXXXX
      [04-21-21 1:06:12 pm]            - Tasks started for host XXXXX!
      

      But it never shows:

      [01-18-20 10:35:05 pm]  * Sending 1 wake on lan request.
      [01-18-20 10:35:05 pm]  * 1 total mac attempting to wake up.
      

      Any idea why FOG is not waking computers up when scheduled?

      Thanks!
      Peter

      P A 2 Replies Last reply Reply Quote 0
      • P
        Petěrko @Tom Elliott last edited by

        @tom-elliott
        @Sebastian-Roth

        Thank you all. It is solved now in 1.5.9.78 with HTTPS on.

        /var/log/apache2/other_vhosts_access.log

        80 "POST /fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 302 599 
        443 "GET //fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 9111 
        443 "POST /fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 9111 
        

        /opt/fog/log/fogscheduler.log for Power Management Task

        [04-29-21 6:16:25 am]  * 1 task found.
        [04-29-21 6:16:25 am]  * 0 scheduled task(s) to run.
        [04-29-21 6:16:25 am]  * 1 power management task(s) to run.
        [04-29-21 6:16:25 am]  * Power Management Task run time: Thu, 29 Apr 2021 06:16:00 +0000
        [04-29-21 6:16:25 am]  * This is a cron style task that should run at: 1619676960.
        [04-29-21 6:16:25 am]  * Found a wake on lan task that should run.
        [04-29-21 6:16:25 am]  | Task sent to fcaa-https
        

        /opt/fog/log/fogscheduler.log for Scheduled Task:

        [04-29-21 6:22:26 am]  * 1 task found.
        [04-29-21 6:22:26 am]  * 1 scheduled task(s) to run.
        [04-29-21 6:22:26 am]  * 0 power management task(s) to run.
        [04-29-21 6:22:26 am]  * Scheduled Task run time: Thu, 29 Apr 2021 06:22:00 +0000
        [04-29-21 6:22:26 am]  * This is a cron style task that should run at: 1619677320
        [04-29-21 6:22:26 am]  * Found a scheduled task that should run.
        [04-29-21 6:22:26 am]            - Is a host based task.
        [04-29-21 6:22:26 am]            - Unicaset task found!
        [04-29-21 6:22:26 am]            - Host fcaa-https
        [04-29-21 6:22:26 am]            - Task started for host fcaa-https!
        

        Thank you again! Now our school can wake-up on Schedule 😉

        Peter

        1 Reply Last reply Reply Quote 0
        • S
          Sebastian Roth Moderator last edited by

          @petěrko said in Scheduled Wake On Lan:

          Is POST with status 302 on port 80 ok? It may be redirection to https, I guess.
          I think GET for HTTPS is wrong. It gives 200 but I think server doesnt have enough info what to wake up.

          Great work! Thanks heaps for testing in detail and posting here.

          As Tom said, it happens to be redirected to HTTPS (443) when sending a POST to HTTP (80). There is a good explanation on why this happens on stack exchange: https://softwareengineering.stackexchange.com/questions/99894/why-doesnt-http-have-post-redirect

          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
          • Tom Elliott
            Tom Elliott @Petěrko last edited by

            @petěrko I altered the code to run through:

            https:// AND http:// (in order)
            so that wakeOnLAN should run regardless of which protocol you send (and more directly in the case you have a 302 redirect from http to https.

            Please give it a try and let me know if it works.

            Thank you,

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            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

            P 1 Reply Last reply Reply Quote 0
            • Tom Elliott
              Tom Elliott @Petěrko last edited by

              @petěrko Well a redirect from 80 to 443 via 302 will take the post request and send it as get (meaning the mac address it’s intending to receive is missing)

              I can attempt to iterate through beginning with https

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              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
              • P
                Petěrko @Petěrko last edited by

                Update: Same on 1.5.9.77
                Peter

                Tom Elliott 1 Reply Last reply Reply Quote 0
                • P
                  Petěrko @Tom Elliott last edited by

                  @tom-elliott Thanks for reply and your great work, Tom.
                  I am looking into it again with more detail.

                  HTTP Cron WOL
                  port 80, POST, status 200
                  HTTP Cron WOL working

                  x.x.x.x:80 x.x.x.x - - [28/Apr/2021:02:51:07 -0400] "POST /fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 5068 "-" "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
                  

                  HTTPS instant WOL
                  port 443, POST, status 200
                  HTTPS Instant WOL working

                  x.x.x.x:443 x.x.x.x - - [28/Apr/2021:03:17:13 -0400] "POST /fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 9111 "-" "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
                  

                  HTTPS Cron WOL
                  port 80, POST, status 302
                  and
                  port 443 GET,status 200
                  HTTPS Cron WOL not working

                  x.x.x.x:80 x.x.x.x - - [28/Apr/2021:03:23:20 -0400] "POST /fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 302 580 "-" "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
                  x.x.x.x:443 x.x.x.x - - [28/Apr/2021:03:23:20 -0400] "GET //fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 9111 "-" "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
                  

                  Is POST with status 302 on port 80 ok? It may be redirection to https, I guess.

                  I think GET for HTTPS is wrong. It gives 200 but I think server doesnt have enough info what to wake up.

                  Or am I wrong?
                  Peter

                  P Tom Elliott 2 Replies Last reply Reply Quote 0
                  • Tom Elliott
                    Tom Elliott @Petěrko last edited by

                    @petěrko The 200 code tells us that the response was successful.

                    The sprintf call defines httpproto. So while there may be a typo, this is unlikely the thing causing the issue you’re seeing.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    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

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      Petěrko last edited by

                      What about this (from other_vhosts_access.log)?

                      x.x.x.x:443 x.x.x.x - - [27/Apr/2021:10:30:11 -0400] "GET //fog/management/index.php?node=client&sub=wakeEmUp HTTP/1.1" 200 9111 "-" "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
                      

                      Double leading forward slashes (//fog/…).
                      A typo? Or is it correct? Just a guess 😉

                      Source: web/lib/fog/fogbase.class.php

                      $url = '%s://%s/fog/management/index.php?';
                      $url .= 'node=client&sub=wakeEmUp';
                      

                      Peter

                      Tom Elliott 1 Reply Last reply Reply Quote 0
                      • P
                        Petěrko @Sebastian Roth last edited by

                        @sebastian-roth
                        I can confirm now. Https setting during install is the culprit.

                        Debian10 VM 1.5.9
                        http - instant WOL OK, scheduled WOL - working
                        https - instant WOL OK, scheduled WOL - not working

                        Peter

                        1 Reply Last reply Reply Quote 0
                        • P
                          Petěrko @Sebastian Roth last edited by

                          @sebastian-roth Hi, today I found time to install Ubuntu Server 20.04.2 on Bare Metal and KVM (Proxmox). With HTTPS enabled and disabled. Master and DEV-branch. It looks like https problem but I will test it once more to be sure.

                          Scheduled WOL is working on:
                          1.5.9 on Ubuntu (KVM/Baremetal) with https DISABLED

                          Scheduled WOL is not working on:
                          1.5.9 on Ubuntu with https ENABLED
                          19.5.75 on Ubuntu with https ENABLED

                          I will continue on that in @altitudehack 's topic.

                          Peter

                          1 Reply Last reply Reply Quote 0
                          • S
                            Sebastian Roth Moderator last edited by

                            @Petěrko I have not found the time to dive into this yet.

                            I am wondering if it’s along the lines of what @altitudehack posted in the other topic. @Tom-Elliott has worked on the code and maybe knows more about it already?!

                            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

                            P 2 Replies Last reply Reply Quote 0
                            • A
                              altitudehack @Petěrko last edited by altitudehack

                              @petěrko I’m having the same problem with the latest dev branches. It was working fine before I updated. See:
                              https://forums.fogproject.org/topic/15279/daily-wake-up-routine-not-working-after-update/
                              Any way to merge topics?

                              After a fresh look these seem like separate issues. Sorry for the interruption.

                              1 Reply Last reply Reply Quote 0
                              • P
                                Petěrko last edited by

                                Found one more table:

                                INSERT INTO `powerManagement` VALUES (3,1,'20','*','*','*','*','wol','0'),(2,1,'','','','','','shutdown','1');
                                
                                

                                Peter

                                1 Reply Last reply Reply Quote 0
                                • P
                                  Petěrko @Sebastian Roth last edited by

                                  @sebastian-roth Thanks for reply, Sebastian!

                                  I am not sure what settings would you like to see. Fog Settings? I can upload globalSettings table, if it helps…

                                  When I export settings I get this for Power Task:

                                  INSERT INTO `scheduledTasks` VALUES (1,'Wake-Up Task','','S',14,'','','','','','',1,0,'','','-1','fog','1','',1619075220,'0');
                                  

                                  This is log for Scheduled Power WOL Task:
                                  host-cron-schedule.png

                                  [04-22-21 10:19:02 am]  * 1 task found.
                                  [04-22-21 10:19:02 am]  * Task run time: Thu, 22 Apr 2021 10:58:00 +0200
                                  [04-22-21 10:20:02 am]  * 1 task found.
                                  [04-22-21 10:20:02 am]  * Task run time: Thu, 22 Apr 2021 10:20:00 +0200
                                  [04-22-21 10:20:02 am]  * Found a wake on lan task that should run.
                                  [04-22-21 10:20:02 am]  | Task sent to test-mmu
                                  [04-22-21 10:21:02 am]  * 1 task found.
                                  [04-22-21 10:21:02 am]  * Task run time: Thu, 22 Apr 2021 11:20:00 +0200
                                  

                                  SQL for Scheduled Wake-Up Task looks bit better but still doesn’t work:

                                  INSERT INTO `scheduledTasks` VALUES (2,'Wake-Up Task','','C',14,'44','*','*','*','*','',1,0,'','','-1','fog','1','',0,'1');
                                  

                                  Peter

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    Sebastian Roth Moderator last edited by Sebastian Roth

                                    @petěrko Can you please post a picture of your settings in the FOG web UI?

                                    Is the process/code for WOL Perform Immediately and cron-style same or different?

                                    Yes, “Perform Immediately” is directly triggered when submitting the form while cron-style is fired by the scheduler.

                                    WOL Perform Immediately is working fine.

                                    Don’t think it’s a network issue then.

                                    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

                                    P 1 Reply Last reply Reply Quote 0
                                    • P
                                      Petěrko @Petěrko last edited by

                                      Hi again,

                                      today I tried CentOS 7 + FOG dev-branch. Later upgraded to working-1.6 branch. Still no success.

                                      Should fogscheduler.log report this when waking PCs from scheduled task?

                                      [01-18-20 10:35:05 pm]  * Sending 1 wake on lan request.
                                      [01-18-20 10:35:05 pm]  * 1 total mac attempting to wake up.
                                      

                                      It is not showing in my log…
                                      Is the process/code for WOL Perform Immediately and cron-style same or different?

                                      May the problem be network related? Subnets? VLANs?
                                      Or KVM related? I run OSes as Virtual Machines on Proxmox.
                                      WOL Perform Immediately is working fine.

                                      Thank you for any help!
                                      Peter

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

                                      144
                                      Online

                                      10.4k
                                      Users

                                      16.4k
                                      Topics

                                      150.5k
                                      Posts

                                      Copyright © 2012-2023 FOG Project