Cron + hypernate and unhibernate + Bash script



  • Working on the code

    
    under development
    
    


  • ~~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



  • 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?


  • Moderator

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



  • 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


  • Netgate Administrator

    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



  • 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.



  • Ok wol is working again.

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


  • Netgate Administrator

    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.  ::)



  • 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.



  • 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?