• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Cron for WOL

Scheduled Pinned Locked Moved General pfSense Questions
24 Posts 7 Posters 6.2k Views 5 Watching
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.
  • K Offline
    Khampol
    last edited by Sep 26, 2017, 3:35 AM

    Hello,

    I find an old topic here but comand do not work. Please could someone update the right command?

    https://forum.pfsense.org/index.php?topic=30966.0

    :-\

    1 Reply Last reply Reply Quote 0
    • G Offline
      Gertjan
      last edited by Sep 26, 2017, 7:24 AM

      What do you mean ?

      [2.3.4-RELEASE][admin@pfsense.brit-hotel-fumel.net]/root: wol
      wol: Too few arguments.
      Try `wol --help' for more information.
      [2.3.4-RELEASE][admin@pfsense.brit-hotel-fumel.net]/root: wol --help
      Usage: wol [OPTION] ... MAC-ADDRESS ...
      Wake On LAN client - wakes up magic packet compliant machines.
      
          --help          display this help and exit
      -V, --version       output version information and exit
      -v, --verbose       verbose output
      -w, --wait=NUM      wait NUM millisecs after sending
      -h, --host=HOST     broadcast to this IP address or hostname
      -i, --ipaddr=HOST   same as --host
      -p, --port=NUM      broadcast to this UDP port
      -f, --file=FILE     read addresses from file FILE ("-" reads from stdin)
          --passwd[=PASS] send SecureON password PASS (if no PASS is given, you
                          will be prompted for the password)
      
      Each MAC-ADDRESS is written as x:x:x:x:x:x, where x is a hexadecimal number
      between 0 and ff which represents one byte of the address, which is in
      network byte order (big endian).
      
      PASS is written as x-x-x-x-x-x, where x is a hexadecimal number between 0
      and ff which represents one byte of the password.
      
      Report bugs to <krennwallner@aon.at></krennwallner@aon.at>
      

      The command works ….
      The cron package exists also now.
      I just woke up our coffee machine.....

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      • K Offline
        Khampol
        last edited by Sep 27, 2017, 5:46 AM Sep 27, 2017, 5:43 AM

        I have this.. (see pict). Normally it should wake my NAS everyday at 10.01.
        It never wake it… :(

        PS : My NAS wakes up if I do WOL manually.

        Region00.png
        Region00.png_thumb

        1 Reply Last reply Reply Quote 0
        • G Offline
          Gertjan
          last edited by Sep 27, 2017, 6:43 AM

          Putting the command in a cron is the final step.

          You tested the command from the console (SSH !) interface ?
          You did set up the NAS so it wakes up on when it receives the WOL packet ?
          Try also to wake it up from a windows PC using : https://sourceforge.net/projects/aquilawol/
          And even : try to wake up a Windows PC (settings have to be made in Windows and may be even the BIOS).
          When you can WOL "by hand" only then you automise (by cron).
          Check if the cron line is executed (see logs).

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          • K Offline
            Khampol
            last edited by Sep 27, 2017, 10:45 AM

            Yes I know what mean WOL ! LOL!  ;D ;D ;D
            Years I do manually (by hand..).

            In Pfsense there is ALSO a function for WOL and "by hand" it works perfectly with my NAS.

            Thats why I am confused…

            Region01.png
            Region01.png_thumb

            1 Reply Last reply Reply Quote 0
            • I Offline
              Issom
              last edited by Feb 6, 2019, 3:20 PM

              Any update on this old topic? I am in the same boat as OP.
              I can manually start my unraid server and test Dell laptop from the WOL menu under Services but when I try to schedule the cron job or run the command manually I do not get the WOL protocol.
              I am monitoring the network traffic from Wireshark and I can see a protocol "WOL" when I run the wake up from the Services menu. When I try to run this command from cron or manually under Diagnostics> command prompt I only see TCP protocols broadcast.
              I am trying to wake both Unraid and Dell laptop.

              here is the commands I have been trying

              /usr/local/bin/wol (Mac address) This will broadcast to entire IP scheme
              /usr/local/bin/wol -v -i 172.x.x.x (Mac address) This only targets the exact IP of the machine

              Any help would be great
              Thanks
              Issom

              K 1 Reply Last reply Oct 18, 2019, 11:09 AM Reply Quote 0
              • G Offline
                Gertjan
                last edited by Feb 6, 2019, 4:06 PM

                Dono ....
                I just power down a PC next to me, and the I typed in

                /usr/local/bin/wol -v -i 192.168.1.7 b8:ac:6f:47:2d:b2
                

                The PC woke up immediately.

                Btw : I use the console access. That the one for 'real' commands.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • S Offline
                  stephenw10 Netgate Administrator
                  last edited by Feb 6, 2019, 8:43 PM

                  It's usually because the user Cron runs with is not admin/root and somethings are subtly different. Default paths, permissions etc. You are using the complete path so that rules that out. Do you see any errors logged at that time?

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • K Offline
                    Kalle13 @Issom
                    last edited by Kalle13 Oct 18, 2019, 1:33 PM Oct 18, 2019, 11:09 AM

                    @Issom Hi,
                    I know what you and OP mean. I have the same issue. It works manually but not via cron.
                    I want to wake up my server at 7 am but it won' t work. So after I realized it was not working I punshed the command in the command line and I got one error. It says that the host was not reachable. But direct after that I used the WOL service of the pfsense and it worked perfectly. (I am using pfSense 2.4.4. p3)
                    So was is the weird behaviour?

                    Best regards

                    "Jeder kocht mit Wasser, man kann das Binsenweisheit nenn`. Der unterschied zu dir ist, dass wir zwei kochen könn`"

                    • Kinderzimmer Productions
                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      Kalle13
                      last edited by Oct 21, 2019, 6:47 PM

                      I've discovered a solution for this problem. Here you can find it. It' s a german post. Translated it says:
                      You have to activate the "static ARP" option at the "DHCP Static Mappings for this Interface" of the DHCP Server. Now you can wake your Host up with (direct from shell or via cron):
                      /usr/local/bin/wol -i IP MAC

                      Best regards

                      "Jeder kocht mit Wasser, man kann das Binsenweisheit nenn`. Der unterschied zu dir ist, dass wir zwei kochen könn`"

                      • Kinderzimmer Productions
                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        stephenw10 Netgate Administrator
                        last edited by Oct 26, 2019, 3:58 PM

                        Hmm, that should not be required. The machine doing the waking should not need to know anything but the MAC address.
                        Does it just not send the packet if you use the MAC only?

                        Steve

                        K 1 Reply Last reply Oct 26, 2019, 10:49 PM Reply Quote 0
                        • K Offline
                          Kalle13 @stephenw10
                          last edited by Oct 26, 2019, 10:49 PM

                          @stephenw10
                          Sorry, I don't know. I didn' t used the wol command without the IP option.

                          "Jeder kocht mit Wasser, man kann das Binsenweisheit nenn`. Der unterschied zu dir ist, dass wir zwei kochen könn`"

                          • Kinderzimmer Productions
                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            pbshaan
                            last edited by Dec 31, 2020, 1:56 AM

                            I bumped into the same problem. Sharing my findings for future visitors (tested with VLANs present - not sure if it matters).

                            Interface required:

                            Specifying the interface is optional, but without it the command doesn't work.

                            • wol xx:xx:xx:xx:xx:xx - executes, but no magic packet to device.
                            • wol -i 192.168.1.255 xx:xx:xx:xx:xx:xx - works.

                            Entries required in /etc/crontab:

                            • Manually add job definition to /etc/crontab - works, job triggers.
                            • crontab -e (as root user) - reports success, but job doesn't trigger. I also tried restarting cron after adding entries as another post suggested, but no luck.

                            So, edit /etc/crontab file directly and add your entry there. For the interface address, either machine IP or broadcast IP may be specified.

                            e.g.. /etc/crontab

                            ...
                            
                            # Wake up server at 6:30
                            30      6       *       *       *       root    wol -i 192.168.1.255 c0:3f:d5:66:XX:XX
                            
                            ...
                            
                            #
                            # If possible do not add items to this file manually.
                            
                            
                            G 1 Reply Last reply Dec 31, 2020, 6:31 AM Reply Quote 1
                            • G Offline
                              Gertjan @pbshaan
                              last edited by Dec 31, 2020, 6:31 AM

                              @pbshaan said in Cron for WOL:

                              So, edit /etc/crontab file directly

                              😵

                              pfSense most simple package might be useful here.
                              Introducing the wol package :

                              bb18c5ad-908a-4447-8c3a-4621fcc7cc46-image.png

                              Now, your own crons will even be saved in the global pfSense config, making it a real set it and forget it thing.

                              Also, according to the "official manual" :

                              0d60bcc0-82f6-4e13-b8ba-ec4b10700f4a-image.png

                              If FreeBSD was installed on desktop type device with a single NIC, then this option is an option as there is only one NIC.
                              Our pfSense tends to have at least 2 NICs. So the option is qualified as "important".
                              I guess it's even a security issue if wol starts to send its notifications on all my xx interfaces.

                              No "help me" PM's please. Use the forum, the community will thank you.
                              Edit : and where are the logs ??

                              1 Reply Last reply Reply Quote 1
                              • Bob.DigB Offline
                                Bob.Dig LAYER 8
                                last edited by Bob.Dig Oct 20, 2021, 8:34 AM Oct 20, 2021, 8:29 AM

                                Also had no luck getting wol with cron to work, the command is not even working in the GUI command prompt...

                                /usr/local/bin/wol -v -i 192.168.1.21 dx:50:99:92:11:e7
                                /usr/local/bin/wol dx:50:99:92:11:e7

                                Capture2.png

                                But working flawlessly via the pfSense >Services>Wake-on-LAN

                                G 1 Reply Last reply Oct 20, 2021, 8:39 AM Reply Quote 0
                                • G Offline
                                  Gertjan @Bob.Dig
                                  last edited by Gertjan Oct 20, 2021, 8:42 AM Oct 20, 2021, 8:39 AM

                                  @bob-dig

                                  I ping 192.168.1.2 : it's powered down.
                                  I "wol" it.
                                  It ping again and it replies ....

                                  [2.5.2-RELEASE][admin@pfsense.local.net]/root: wol
                                  wol: Too few arguments.
                                  Try `wol --help' for more information.
                                  [2.5.2-RELEASE][admin@pfsense.local.net]/root: ping 192.168.1.2
                                  PING 192.168.1.2 (192.168.1.2): 56 data bytes
                                  ^C
                                  --- 192.168.1.2 ping statistics ---
                                  3 packets transmitted, 0 packets received, 100.0% packet loss
                                  [2.5.2-RELEASE][admin@pfsense.brit-hotel-fumel.net]/root:  wol -v -i 192.168.1.2 00:4e:01:ac:ca:9c
                                  Waking up 00:4e:01:ac:ca:9c with 192.168.1.2:40000...
                                  [2.5.2-RELEASE][admin@pfsense.local.net]/root: ping 192.168.1.2
                                  PING 192.168.1.2 (192.168.1.2): 56 data bytes
                                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=128 time=0.255 ms
                                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=128 time=0.325 ms
                                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=128 time=0.333 ms
                                  64 bytes from 192.168.1.2: icmp_seq=5 ttl=128 time=0.291 ms
                                  ^C
                                  --- 192.168.1.2 ping statistics ---
                                  6 packets transmitted, 4 packets received, 33.3% packet loss
                                  round-trip min/avg/max/stddev = 0.255/0.301/0.333/0.031 ms
                                  

                                  In the past, when wol was still a magic (pun intended) thing, there was a tool that you could run on the device to be waken up : it showes you that it's NIC did receive the magic wake up packets.
                                  These packets are used to wake up the device, if it is able to do so, and if it was allowed to do (by driver and or BIOS settings).

                                  No "help me" PM's please. Use the forum, the community will thank you.
                                  Edit : and where are the logs ??

                                  Bob.DigB 1 Reply Last reply Oct 20, 2021, 8:44 AM Reply Quote 1
                                  • Bob.DigB Offline
                                    Bob.Dig LAYER 8 @Gertjan
                                    last edited by Bob.Dig Oct 20, 2021, 8:50 AM Oct 20, 2021, 8:44 AM

                                    @gertjan One difference might be that my NIC doesn't have an IP address, its only purpose it to wake up the PC.

                                    And again, it is working flawlessly via the GUI Services>Wake-on-LAN

                                    G 1 Reply Last reply Oct 20, 2021, 10:43 AM Reply Quote 0
                                    • G Offline
                                      Gertjan @Bob.Dig
                                      last edited by Gertjan Oct 20, 2021, 10:43 AM Oct 20, 2021, 10:43 AM

                                      @bob-dig said in Cron for WOL:

                                      And again, it is working flawlessly via the GUI Services>Wake-on-LAN

                                      GUI Services>Wake-on-LAN ?
                                      Aha, you mean https://pfsense.yourlocal.tld/services_wol.php.

                                      You had a look how "services_wol.php" does it's wol thing ?
                                      ( it used the wol command like you ;) )

                                      See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_wol.php - line 51.

                                      'wol' needs an IP ( ?) so it can determine the interface to be used..
                                      The interface has an IP, right ?

                                      When I used a fake IP, like 192.168.1.200 instead of 192.168.2, my "00:4e:01:ac:ca:9c" device didn't wake up.

                                      No "help me" PM's please. Use the forum, the community will thank you.
                                      Edit : and where are the logs ??

                                      1 Reply Last reply Reply Quote 1
                                      • S Offline
                                        stephenw10 Netgate Administrator
                                        last edited by Oct 20, 2021, 12:46 PM

                                        What happens if you use the pfSense interface IP there? In the same segment as the target?

                                        Bob.DigB 1 Reply Last reply Oct 20, 2021, 1:18 PM Reply Quote 0
                                        • Bob.DigB Offline
                                          Bob.Dig LAYER 8 @stephenw10
                                          last edited by Bob.Dig Oct 20, 2021, 1:25 PM Oct 20, 2021, 1:18 PM

                                          @stephenw10 Doesn't work either and yes.

                                          If I try with putty I get this.

                                          [2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol -v -i 192.168.1.1 d0:50:99:92:11:e7
                                          Waking up d0:50:99:92:11:e7 with 192.168.1.1:40000...
                                          [2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol -v d0:50:99:92:11:e7
                                          /usr/local/bin/wol: Cannot send magic packet for 'd0:50:99:92:11:e7' to 255.255.255.255:40000: Permission denied
                                          [2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol d0:50:99:92:11:e7
                                          /usr/local/bin/wol: Cannot send magic packet for 'd0:50:99:92:11:e7' to 255.255.255.255:40000: Permission denied
                                          [2.5.2-RELEASE][admin@pfSense.home.arpa]/root:
                                          
                                          

                                          But again, none of this worked.

                                          G 1 Reply Last reply Oct 20, 2021, 1:48 PM Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                            [[user:consent.lead]]
                                            [[user:consent.not_received]]