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

    Cron + hypernate and unhibernate + Bash script

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 3 Posters 2.0k Views
    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.
    • A
      aGeekhere
      last edited by

      ~~Must have done something to my /usr/local/bin/wol file as i am getting Syntax error: "(" unexpected'

      Where can I find a copy of the wol file?~~

      ok found the file

      When i go Diagnostics: Execute command and upload File to upload where is the location?

      It seems that upload file does not work

      find / -name wol

      does not find the new file

      Never Fear, A Geek is Here!

      1 Reply Last reply Reply Quote 0
      • A
        aGeekhere
        last edited by

        Hmm getting a Permission denied when trying to upload the new wol file to /usr/local/bin

        Command
        /usr/local/bin

        Upload file
        wol

        output
        $ /usr/local/bin
        /usr/local/bin: Permission denied

        Any ideas?

        Never Fear, A Geek is Here!

        1 Reply Last reply Reply Quote 0
        • BBcan177B
          BBcan177 Moderator
          last edited by

          Make sure you SSH or SFTP or whatever you are using as "root"

          "Experience is something you don't get until just after you need it."

          Website: http://pfBlockerNG.com
          Twitter: @BBcan177  #pfBlockerNG
          Reddit: https://www.reddit.com/r/pfBlockerNG/new/

          1 Reply Last reply Reply Quote 0
          • A
            aGeekhere
            last edited by

            I am using the pfsense GUI under Diagnostics: Execute command

            How do i do root there?

            this does not work

            root /usr/local/nameOfnewFile

            Then upload

            UPDATE
            OK strange thing, I can upload text files and other files BUT not the wol file!!!
            Even tried renaming it and giving it an extension, no go
            Do not feel like reformatting again, any ideas?

            UPDATE
            OK i have ziped it, now it uploads, now just need to unzip it

            UPDATE
            Ok i gave it a exe extension, uploaded it copied it to its location and gave it its permissions, no more errors.

            Update
            Because the file is now blank…

            Update
            Ok i am stuck, how come i cant upload the wol file,
            i can zip it then upload, but pfsense has no unzip
            i can change it to an exe
            but when  i rename it the file is blank

            Never Fear, A Geek is Here!

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              If you upload the file using SCP instead of via the gui you won't have those restrictions.

              How are you proposing to remotely force the mschines to hibernate?

              Steve

              1 Reply Last reply Reply Quote 0
              • A
                aGeekhere
                last edited by

                decided to reinstall.

                How are you proposing to remotely force the mschines to hibernate?

                That is a good question, been looking for a hibernate/sleep on lan command.

                Can a magic package send a hibernate command?

                maybe for linux something like pm-hibernate MAC ADDRESS

                Worst case run the hibernate script on the computer to be hibernated.

                Never Fear, A Geek is Here!

                1 Reply Last reply Reply Quote 0
                • A
                  aGeekhere
                  last edited by

                  Ok wol is working again.

                  With arp can we set the expiry time from 1200 seconds to say 200 seconds?

                  Never Fear, A Geek is Here!

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    As far as I know there is no included suspend functionality at a firmware level like WOL. It would be a massive security problem. You would have to run something on each client that listened for commands. There is almost certainly something already in existence to do it. If you're running Windows and have any sort of central management setup this is relatively trivial (I assume because I've never tried it  ::)).

                    Steve

                    Edit: can't spell my own name.  ::)

                    1 Reply Last reply Reply Quote 0
                    • A
                      aGeekhere
                      last edited by

                      Thanks Streve.

                      I think how I will do this is run two kinds of cron jobs (I can use the same code with a few changes with the hypernate/unhibernate function).

                      First cron job is ran on pfsense to do the unhibernating.

                      The second one is then ran on each local server.

                      So the local server cron hypernates the server.

                      Then the pfsense cron unhibernates the servers.

                      Never Fear, A Geek is Here!

                      1 Reply Last reply Reply Quote 0
                      • A
                        aGeekhere
                        last edited by

                        How can I now test the bash script?

                        I have cron installed (using the GUI) with

                        */1 * * * * root /home/wolserver

                        And the code is in wolserver.

                        nothing is happening and I see no logs (do not even know if cron is running the script), am i missing something?

                        Never Fear, A Geek is Here!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.