 |
 |
AppleScript: possible to run shell scripts without opening Terminal.app??
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Huddersfield, UK
Status:
Offline
|
|
I'm in the middle of writing an AppleScript script that can extract various bits of information from the wealth of information provided by such terminal commands as ps, df, vm_stat, uname, hostinfo etc...
Because the script has to access the shell regularly, I have been wondering if this is possible without opening a Terminal window every time I need to get some info...
I don't have AppleScript Studio (using a 56 kbps modem)... but if someone could shed some light on the matter, I'd be most grateful.
Also, could someone comment on other possible ways of accessing the shell, be it using Obj-C, C++, C, Java or whatever. I'd like to know if there was a better way to do this (I'm can't program in any of the mentioned languages, but I figure that if I just want to extract information, if can't be that difficult, right??  )
Cheers, Richard
|
|
PM G4 DP 500 MHz, 768 Mb, DVD-ROM, 85 Gb, Mac OS X 10.3.9
PB G4 1.25 GHz, 512 Mb, DVD-R, 80 Gb, Mac OS X 10.4
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Jan 2002
Location: New York
Status:
Offline
|
|
Try this:
do shell script "blah"
if you want to do it as an admin do:
do shell script "blah" password "cookie" with administrator privileges
Hope that helps!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2001
Location: 127.0.0.1
Status:
Offline
|
|
I've attempted to put together a simple AppleScript which will allow me to start/stop my local MySQL server from a GUI. I managed to find the "do shell script" routine ksuther mentioned above, and this approach works great for stopping the server. However, starting the server requires that mysqld be fired off as a background process, and AppleScript sits there waiting for the process to return. Is there any way to get my script to "detach" itself from this background process so it doesn't hang waiting?
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2001
Location: Pittsburgh, PA USA
Status:
Offline
|
|
Excellent - I came here planning to ask "how do I run a shell script as root from an AppleScript?" and ran straight into the answer. Thanks - now I have dock items that will let me start and stop IP forwarding my PPP connection to another box.
Danke,
Jeff
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Huddersfield, UK
Status:
Offline
|
|
Thanks very much for your help, ksuther! And I'm glad that this thread is helping other people too...
Thanks again,
Richard
|
|
PM G4 DP 500 MHz, 768 Mb, DVD-ROM, 85 Gb, Mac OS X 10.3.9
PB G4 1.25 GHz, 512 Mb, DVD-R, 80 Gb, Mac OS X 10.4
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|