bhilgenkamp
asked on
AppleScript to run termninal commands
Sorry, this may be painfully simple, but I have no idea where to start. I want to create an applescript to ssh into another machine and run a command. Here's what I have been doing:
ssh user@machine.local
password
sudo /System/Library/CoreServic es/RemoteM anagement/ ARDAgent.a pp/Content s/Resource s/kickstar t -restart -agent
password again
exit
Can I put all of this into a script? Not concerned about the safety of the password. I would also like to be able to do this 4 times to 4 different machines.
If not applescript, is there something I can use to do this?
ssh user@machine.local
password
sudo /System/Library/CoreServic
password again
exit
Can I put all of this into a script? Not concerned about the safety of the password. I would also like to be able to do this 4 times to 4 different machines.
If not applescript, is there something I can use to do this?
ASKER
Sorry.... How would I format that for the .sh file? I'm very new to this
Hi.
Before I actually get round to giving you some decent advice (sorry about the delay), is the password the same for each computer? Or different for each?
Gileze33.
Before I actually get round to giving you some decent advice (sorry about the delay), is the password the same for each computer? Or different for each?
Gileze33.
ASKER
Quite alright, it was a welcome surprise.... Yes, the username and password are the same for all the comptuers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi.
I've had another think about this, and have thought of an alternative method.
You can use something like Expect.
To download expect, you need to get Darwin Ports, then go to the terminal and type "sudo port install expect".
If this isn't too much hassle, I'll write you a quick Expect script if thats ok with you.
Gileze33.
I've had another think about this, and have thought of an alternative method.
You can use something like Expect.
To download expect, you need to get Darwin Ports, then go to the terminal and type "sudo port install expect".
If this isn't too much hassle, I'll write you a quick Expect script if thats ok with you.
Gileze33.
Hi.
I have also been thinking of yet another, even easier method - I could spend five minutes of my time making a little REALbasic app that does it for you :)
I could then make a text file which holds the command to be run.
Is this still wanted?
Gileze33.
I have also been thinking of yet another, even easier method - I could spend five minutes of my time making a little REALbasic app that does it for you :)
I could then make a text file which holds the command to be run.
Is this still wanted?
Gileze33.
ASKER
Please. That would be great
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then, in applescript, you put in:
do shell script "/my-command-file-path"
Gileze33