View Full Version : For the apple script masters
jimsowden
Sep 1, 2004, 06:57 PM
I don't use apple script, but i want to get started. I work at an apple dealer, and i want to write a script to shut down all the demo computers. I know how to do this remotley, which is to
open terminal,
type in ssh user@ipaddress
it prompts for password
enter sudo -s
it enters password
enter shutdown -h now.
I would need this for more than one computer obviously, so if anyone it up to it, a starter script would be much appriciated.
iLikeMyiMac
Sep 1, 2004, 07:08 PM
Couldn't you just flip the circuit breaker? :D
Is this something you need to do at random times throughout the day, or do you just want to shut them down at night before you leave?
If it's the latter, you can use the System Prefs > Energy Saver to tell them to shut down at a certain time every day.
jimsowden
Sep 1, 2004, 08:59 PM
Is this something you need to do at random times throughout the day, or do you just want to shut them down at night before you leave?
If it's the latter, you can use the System Prefs > Energy Saver to tell them to shut down at a certain time every day.
I know about that. I can't get it to do different days and remember. It doesn't work that well.
jimsowden
Sep 1, 2004, 10:45 PM
I'm sure somebody knows.
jimsowden
Sep 1, 2004, 11:14 PM
Ok, i got this far:
tell application "Terminal"
activate
do shell script "sudo ssh jimsowden@10.0.1.3" password "xxx" with administrator privileges
do shell script "shutdown -h now"
end tell
That opens it. Now, it should log me in, but it says "Terminal got an error: Pseudo-terminal will not be allocated because stdin is not a terminal.
Host key verification failed."
Any ideas?
cpjakes
Sep 1, 2004, 11:32 PM
If you work at an Apple dealer, why not just use Remote Desktop, manage your demo computers as a group, and just shut them all down at once?
cpjakes
jimsowden
Sep 1, 2004, 11:56 PM
Net admin won't let me. I wanted to have netboot, but that was out of the question. This is all i got. I got to typing
tell application "terminal" to do shell script "ssh jimsowden@10.0.1.3" password "xxx" with administrator privileges
but this returns a psuedo terminal error. I have no idea why.
superbovine
Sep 1, 2004, 11:57 PM
you shouldn't use applescript for this.
the easy way is to use crontab and a script using the shutdown command in terminal.
http://clc.its.psu.edu/Labs/Mac/resources/authdoc/cron.aspx
http://www.macosxhints.com/article.php?story=2001020700163714
http://www.ss64.com/osx/shutdown.html
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.