Applescript send commands through Terminal
Need Applescript to open Terminal, then ssh testname@192.168.1.10, and then type in the password, then type in "sudo poweroff", then type in the password again.
Right now I have
tell application "Terminal"
do script ("ssh testname@192.168.1.10;")
delay 6
do script ("password")
do script ("sudo poweroff")
delay 6
do script ("password")
end tell
but Terminal stops and asks for a password response for the initial ssh request.
I'm trying to have my mac Applescript (from a calendar event daily) run this to shutdown another computer (linux) on the house network.
NOTE: if I manually open Terminal on my mac, and just type in ssh testname@192.168.1.10, it asks for the password, I type it in, and it logs in. Then I just type in sudo poweroff , then it asks for the password again, I type it in, and the other machine shuts down without a problem.
So, my issue is Applescript is not telling Terminal to just do the same thing automatically from the applescript for some reason. I've tried just about everything I can think of and am stumped. I KNOW it can be done, because I can manually do it by tying in Mac Terminal. Just can't get Applescript to do it?