Hi,
“What? PHP? Windows? This is an Applescript forum, did you know?”
Yes, I’m sorry, but let me explain.
I’m learning PHP with my Mac, and have my apache server with everything loaded. I found a way to turn on my second computer with a WakeOnLan function in PHP. Now I want to turn it off…
I managed to install a ssh server on the windows pc, and with Terminal, if I run “ssh user@host ‘shutdown’” it shuts down beautifully.
When I manually run:
on run
do shell script "ssh user@host 'shutdown'"
end run
It also runs beautifully, and shuts down the PC. But when I call the script with osascript… it connects, and disconnects, and does not turn off the machine.
This is the bit of code that I just load in index.php as a matter of testing:
I know that this is a Frankestein of a question… but since it involves applescript, and this osascript call… then maybe you gurus could shed some light as to why it doesn’t do what it should when I call it from php.
Thanks for you answers and your time!
PS: the ssh command doesn’t ask for a password because the mac is authenticated with a public key, and it works perfectly without prompting for the password.