Hey there =)
I am trying to get my windows pc to sleep via Openhab. I am using a script pcshutdown.sh
#!/bin/sh .# Shutdown script ipaddress=192.168.178.57 user=XXX password=XXX net rpc shutdown --comment "Shutdown request from openHAB..." --force -I $ipaddress -U $user%$password
Shutting down the computer works just fine, however I’d like to put it to sleep. Replacing the
just shuts the pc down and doesn’ care about the /h
gives me the error
./pcshutdown2.sh: 2: ./pcshutdown2.sh: .#: not found Usage: net rpc shutdown Shut down a remote RPC server
Another aproach would be to run nircmd on windows and send a request (with SSH?) to the windows server to start the exe with an argument that send the pc to sleep.
However I’d rather use the first way since this is almost completed. Do you have an idea on how to use the net rpc so it will send the pc to sleep?