Git Product home page Git Product logo

Comments (4)

SR-G avatar SR-G commented on May 30, 2024

Hey.

I see.
At first i was using a (configurable) command but it wasn't working well on windows so i switched on windows to a DLL API call instead (but it's still configurable for linux).
I'll see how i can restore the possibility to configure the executed command on windows (that way you should then be able to use a "shutdown" command instead of a "sleep" one).

from sleep-on-lan.

AtmanActive avatar AtmanActive commented on May 30, 2024

Thanks.

Issuing a windows DLL API call to perform a shutdown is also OK.

Sure, I could fork the project and just change the line 15 in sleep-on-lan/src/main/go/sol/sleeper_windows.go, but then we would have two separate projects, one for sleep and the other for shutdown, where it would be best if it could be a single program and just a config line 'shutdown=1' that would do shutdown instead of sleep.
In that way, the user can experiment and try both approaches.

I think I could do it, if you wish, but then I would just kindly ask you to instruct me about how to compile it.

from sleep-on-lan.

SR-G avatar SR-G commented on May 30, 2024

Yep.

I'm about to commit a modification that won't change anything by default, but that will allow to customize the command executed (and also to register new additionnal commands if needed).

In your case you'll have to configure the sol.json configuration file with something like :

{
  "Listeners" : ["UDP:9", "UDP:7", "HTTP:8009" ],
  "LogLevel" : "INFO",
  "Commands" : [ 
    {
        "Operation" : "halt",
        "Command" : "C:\\Windows\\System32\\Shutdown.exe -s -t 0"
    }
  ]
}

With only one command defined, that command will be used by default (and thus will react to magic packets).
This operation will also be published (if an HTTP listener is defined) on the http://<IP>:<HTTP_PORT>/halt URL if you want / need to call it from a remote system through http (with curl or wget or anything else).

I'm not willing to have in the configuration "shutdown = 1" or something like that, because if someone needs someday an "hibernate-on-sleep" or anything else, it would then be necessary to deal with all behaviors in code (for all platforms). The "sleep-on-lan behavior" by default + the possibility to customize anything else if needed, as generic commands, seems less restrictive.

from sleep-on-lan.

AtmanActive avatar AtmanActive commented on May 30, 2024

Hi Serge,

Thank you very much for your quick upgrades.

Unfortunately, I can't make it work.

Continued here:
#2
#3

from sleep-on-lan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.