Comments (12)
I think you have two issues :
- "Default" is a boolean so should be configured without quotes
"Default" : false
- In the configured command, you are using windows backslashes, so
\w
is handled as a special character, wherehas you have to use double backslashes :"Command" : "C:\\Windows\\System32\\Shutdown.exe /r /f /t 0"
(as visible in the examples in README.md)
from sleep-on-lan.
Thanks very much Serge for your fast answer !
I note that place "Commands" in the sol.json config file disable the original commands in the application.
What is the original code of the 3 original opérations please? (sleep/hibernate/shutdown)
For some interested, I wrote; ( with \\ to have \ ... ;-) )
{
"Listeners" : ["UDP:9", "UDP:7", "HTTP:8009" ],
"LogLevel" : "INFO",
"BroadcastIP" : "192.168.1.255",
"ExitIfAnyPortIsAlreadyUsed" : false,
"AvoidDualUDPSending" : {
"Active": true,
"Delay": "100ms"
},
"Commands" : [
{
"Operation" : "restart",
` "Command" : "C:\\Windows\\System32\\Shutdown.exe /r /f /t 5",`
"Default" : false
},
{
"Operation" : "sleep",
` "Command" : "C:\\Windows\\System32\\rundll32.exe powrprof.dll,SetSuspendState 0,1,0",`
"Default" : true
},
{
"Operation" : "hybernate",
` "Command" : "C:\\Windows\\System32\\Shutdown.exe /h /f /t 5",`
"Default" : false
},
{
"Operation" : "lock",
` "Command" : "C:\\Windows\\System32\\rundll32.exe user32.dll,LockWorkStation",`
"Default" : false
},
{
"Operation" : "close",
` "Command" : "C:\\Windows\\System32\\Shutdown.exe /l",`
"Default" : false
},
{
"Operation" : "shutdown",
` "Command" : "C:\\Windows\\System32\\Shutdown.exe /s /f /t 5",`
"Default" : false
}
]
}
from sleep-on-lan.
Indeed when you are writing custom commands, it "overrides" the default ones.
If you want to replicate the default operations, on windows, you have to put these ones ("Default" is just the one reacting to reversed mac address sent through WOL / all commands are otherwise of course triggerable through HTTP) :
"Commands" : [
{
"Operation" : "sleep",
"Type" : "internal-dll",
"Default" : true
},
{
"Operation" : "shutdown",
"Type" : "internal-dll",
"Default" : false
},
{
"Operation" : "hibernate",
"Type" : "internal-dll",
"Default" : false
}]
which will internally configure the usage of the windows DLL directly (Powrprof.dll). Of course it's quite similar in the end to "C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0", which is doing the same but in a different way.
Shutdown is using "Advapi32.dll".
from sleep-on-lan.
Thank's ! :-)
from sleep-on-lan.
Sorry Serge, just one other thing,
how can I launch an app on a path with a space ..?
like "Command" : "C:\Program Files (x86)\TeamViewer\TeamViewer.exe",
the space caracters seems make problem.
the config file .json doesn't make problem, the SOL start and works fine, but the command doesn't works...
thanks for your help :-)
from sleep-on-lan.
Either put "C:\Program~2\TeamViewer..." (check with WIN + R that it's the proper number, either ~1 either ~2), either also put proper backslashes before spaces ("\ "). And, again, all backslashes have to put also prefixed ("\"), as shown in README.md.
from sleep-on-lan.
Thanks Serge,
the right link is 'C:\PROGRA~2\TeamViewer\TeamViewer.exe' , I check with 'DIR %~dp0 /A:D /X' and the link pasted in the Command interface, it launch wel the program, but with SOL not. I receive yet the return message:
<result>
<operation>tv</operation>
<successful>true</successful>
</result>
But ... the app is not running :-( . . . yet the config sol.json is now correct ;
( {
"Operation" : "tv",
"Command" : "C:\\PROGRA~2\\TeamViewer\\TeamViewer.exe",
"Default" : false
}
)
Also, i've writed a litle script to restart the service (in case of modif in sol.json of other...), same problem ...
Maybe the access right ? Is any more to do to run a .bat script? (the batch file is in the same directory of SOL & sol.json)
and ... I do not anderstand how to insert blank space inside a command like
"Command" : "C:\\Program Files (x86)\\TeamViewer\\TeamViewer.exe"
thanks for your help
have a nice evening
from sleep-on-lan.
What are the logs saying ?
(launch it in a "cmd.exe" to see the logs, if it's easier for you)
I've tested this and it's working fine on my side :
"Command" : "C:\\Progra~2\\Intern~1\\iexplore.exe"
from sleep-on-lan.
this is the launching in a Command interface
'''
2022-02-04 18:12:04 INFO sol.go:116 Available commands are :
2022-02-04 18:12:04 INFO sol.go:118 - operation [restart], command [C:\Windows\System32\Shutdown.exe /r /f /t 5], default [false], type [external]
2022-02-04 18:12:04 INFO sol.go:118 - operation [sleep], command [], default [true], type [internal-dll]
2022-02-04 18:12:04 INFO sol.go:118 - operation [hybernate], command [], default [false], type [internal-dll]
2022-02-04 18:12:04 INFO sol.go:118 - operation [lock], command [C:\Windows\System32\rundll32.exe user32.dll,LockWorkStation], default [false], type [external]
2022-02-04 18:12:04 INFO sol.go:118 - operation [close], command [C:\Windows\System32\Shutdown.exe /l], default [false], type [external]
2022-02-04 18:12:04 INFO sol.go:118 - operation [shutdown], command [], default [false], type [internal-dll]
2022-02-04 18:12:04 INFO sol.go:118 - operation [restartservice], command [C:\Users\BrunoRaets\OneDrive\Accessoires\Microsoft\SOL\Win386\RestartServSOL.bat], default [false], type [external]
2022-02-04 18:12:04 INFO sol.go:118 - operation [tv], command [C:\PROGRA~2\TeamViewer\TeamViewer.exe], default [false], type [external]
2022-02-04 18:12:04 INFO listener_udp.go:15 Now listening UDP packets on port [9]
2022-02-04 18:12:04 INFO listener_udp.go:15 Now listening UDP packets on port [7]
'''
and the result of the sending ' curl -f -s --max-time 1 --connect-timeout 1 http://192.168.1.31:(port)/tv '
HOW ! ! it works ...
'
2022-02-04 18:14:26 INFO listener_http.go:221 Executing [tv]
2022-02-04 18:14:26 INFO sleeper_windows.go:35 Executing operation [tv], type[external], command [C:\PROGRA2\TeamViewer\TeamViewer.exe]2\TeamViewer\TeamViewer.exe, string=])
2022-02-04 18:14:26 INFO sleeper_windows.go:46 Sleep implementation [windows], sleep command is [%!(EXTRA string=C:\PROGRA
2022-02-04 18:15:12 INFO sleeper_windows.go:51 Command correctly executed
'
why not when it run as a service ?
from sleep-on-lan.
I would say that this is a Windows issue / security behavior.
Check https://www.coretechnologies.com/blog/windows-services/interact-with-desktop/
but my guess is that this is not allowed anymore by recent windows versions.
from sleep-on-lan.
Hi Serge,
it does'nt work, and seems do not autorize administrator Windows command like run scripts, batch file, ...
sad.
I have another question without solution seen in the forums:
what are the "commands" on linux raspbian to initiate a reboot please ?
Because i've a little Raspbian server, Who's working perfectly with the service SOL but ... when I want to add the "commands" , it doesn't work anymore ...
Original code, who works good for WOL severals computers in the network:
{
"Listeners" : ["UDP:9", "UDP:7", "HTTP:9876" ],
"LogLevel" : "INFO",
"BroadcastIP" : "192.168.1.255",
"ExitIfAnyPortIsAlreadyUsed" : false,
"AvoidDualUDPSending" : {
"Active": false,
"Delay": "100ms"
}
}
but this is the code with the "commands" (seen in your tuto) i tried to add, but then the service doesn't work anymore ...
{
"Listeners" : ["UDP:9", "UDP:7", "HTTP:9876" ],
"LogLevel" : "INFO",
"BroadcastIP" : "192.168.1.255",
"ExitIfAnyPortIsAlreadyUsed" : false,
"AvoidDualUDPSending" : {
"Active": false,
"Delay": "100ms"
},
"Commands" : [
{
"Operation" : "halt",
"Command" : "pm-halt",
"Default" : "false"
},
{
"Operation" : "sleep",
"Command" : "pm-sleep",
"Default" : "true"
}]
}
. . . and what is the "command" to launch a reboot please ?
thanks
from sleep-on-lan.
... also, with the default configuration, I tried several commands to look to the return back :
curl -f -s --max-time 1 --connect-timeout 1 http://192.168.1.104:9876/wol/00:24:8C:75:0B:22
return:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<operation>wol</operation>
<successful>true</successful>
</result>
and
curl -f -s --max-time 1 --connect-timeout 1 http://192.168.1.104:57074/sleep
return:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<operation>sleep</operation>
<successful>true</successful>
</result>
but ...
curl -f -s --max-time 1 --connect-timeout 1 http://192.168.1.104:57074/halt
(or reboot, or restart, or reload, ...)
return:
. . . nothing
from sleep-on-lan.
Related Issues (20)
- Getting confused with syntax and versions HOT 6
- Block program start in case of configuration errors HOT 1
- New command allowing to generate the whole configuration from code
- Switch logging framework to logrus
- Add missing target platform
- Only allow expected command types in custom commands definition
- Log file or event log on Windows? HOT 2
- Incorrect example for Commands? HOT 3
- Have better "default configuration" generated
- Split the ZIP distribution into one archive per platform
- Split README.md into separated pages
- New --verbose parameter
- Extra default filenames
- Logs where not displaying timestamps in line with system's timezone
- No response for HTTP sleep HOT 2
- Have extra delay before executing command HOT 3
- PC sleeps immediately after Wake on Lan after having used sleep on lan HOT 5
- Wake on LAN works strange when service work HOT 1
- Create non-console version, so conhost.exe doesn't also need to run HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sleep-on-lan.