0
I am needing assistance in getting a Mac to go to sleep without the usage of SSH. Almost any other method is acceptable.
Backstory: Product Salesman and Project Manger sold a thing without asking programmers. Programmers now how have to turn on and off a Mac using a product that can only send UDP and TCP strings/hex. It does allow Conduct the painful manual Telnet process, and SSH is completely out of the picture. We are 100% not MAC people.
Things we have tried:
- homebrew's telnetd - refuses to open and console states running for 0 seconds, re-spawning in 10 seconds. Searching for how to debug this has lead to a hundred dead ends of "It should just work!" Which is useless when it doesn't.
- Mac's NC command. While we were able to open an udp session back and forth between our control server and the Mac on ports 3000 and 3001, after googling and finangling this, come to find out not much more can be done with it as far as launching a command.
We attempted to put the NC command inside of a bash script.. this is going terrible, it appears in trying to capture the live output of NC it locks the script on that line and thus parsing never occurs. We did a super simple test script of the below.
output=$(nc -u -l -k 3000; kill$!) echo "$output"
Again, Mac newbs, Bash newbs. Google and Stack Searchboxes have failed us! We did find the command of "pmset sleepnow" which does what we wan, so there's that.
Just looking for a simple way to take a UDP message of "sleep" and it puts the Mac to sleep.
2Why exactly is SSH not an option? – Ecstasy – 2020-01-28T19:51:18.007
You could use Remote Apple Events for this. https://www.makeuseof.com/tag/remotely-control-mac-simple-applescripts/
– Spiff – 2020-01-28T20:01:23.170@Spiff That looked promising at the beginning, but does this only work from one Mac to another? The automation control computer can basically send strings of Hex or ASCII via UDP or TCP. – Antony T. – 2020-01-28T20:12:51.027
@Ecstasy Conducting manual line by line SSH handshakes from a custom programming language (Product sold) or it's included javascript-ish engine which is half baked and doesn't allow libraries is more headache than there are hours in a month. – Antony T. – 2020-01-28T20:13:26.213