-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with shutdown command #113
Comments
There might be another workaround which disables the waiting altogether. See #85 for more information. TLDR; try I've gone through the repository's settings to ensure that public edits of the wiki is allowed. Feel free to edit the parts you feel could be improved. If you think that what you want to change is too far from the original page, feel free to create a new one. The suggestion about having timeouts is great, I'll see what I can do about that. |
That's great, thanks, I did try "returnEarly" : true, but this didn't resolve the issue, unfortunately. I've updated the Wiki with some info on PSShutdown and my suggestion around the delay. |
I've released v4.3.0 which features a timeout option for each command (ping, start, wake and shutdown): |
Closing as this should be solved by using the timeouts. |
Backstory
I've now got this working but wanted to log an issue to suggest that you add this to the Wiki so it can help others.
I have been trying to set up this plugin to power on and off a Windows PC, following the guide in the Wiki (I am using a Synology running homebridge in docker so this guide was invaluable!): https://github.com/AlexGustafsson/homebridge-wol/wiki/Running-on-Synology-Docker-and-turn-Windows-10-on-off-using-SSH-and-Samba
Issue
The issue I had was when I powered off my PC, the plugin would get stuck as the SSH command I was running to power off the Windows machine never returned. I was using PSShutdown with the following config:
ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa Chris@192.168.8.15 "C:\Data\PSTools\psshutdown -d -t 0"
What was happening was as this command was instantly suspending the machine, the SSH session hung and didn't close cleanly. This was stalling the plugin preventing me from powering my machine back on as it never transitioned to off correctly until I restarted home bridge.
I've found a workaround to this issue, which is to apply a 2 second delay to the psshutdown command. This gives the command enough time to finish cleanly before the PC is shutdown and resolves the issue:
ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa Chris@192.168.8.15 "C:\Data\PSTools\psshutdown -d -t 2"
As a further enhancement, it might be worth having a timeout that kills the terminal process if it hangs and allows the plugin to continue running?
The other thing that would be worth adding to the Wiki would be the use of PSShutdown as this allows suspend states. It's also important to ensure that this is run interactively by the user being used for SSH so you can accept the EULA, otherwise this hangs the SSH session.
The text was updated successfully, but these errors were encountered: