Trying to remote shutdown Ubuntu computer on same lan using a Mac computer. If I open Terminal on mac, I CAN shut down the Ubuntu by using: ssh firstname.lastname@example.org, then typing in the password, then typing sudo poweroff, typing in password again. This DOES work.
The problem is I need to do this by using Mac Applescript. (so I can create a Calendar Event and have it run at a certain time of day after backups are done)
NOTE: I have successfully created an Applescript that Wakeonlan turns ON the Ubuntu at a specific time of the day:
tell application "Terminal" set currentTab to do script ("ssh email@example.com;") delay 6 --//password do script ("~/bin/wakeonlan 00:184.108.40.206.55") end tell
This works well, sends the wakeonlan and starts Ubuntu, but I can't figure out how to do the same thing to SHUTDOWN Ubuntu computer? I've tried just about everything? All the posts I find only show how to do this from Ubuntu Terminal, NOT from Mac AppleScript put in Mac's Terminal?