 |
 |
How to run shell scripts from cocoa
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status:
Offline
|
|
How do I run shell scripts from a cocoa app?
I would like to do a simple app that is a front end to apache. it would just have buttons that send commands to the shell like 'apachectl stop'
I guess I'll also need a way to get root access like the lock icon password function in NetInfoManager.
Can someone point me to example code or documentation?
Source code for a simple aqua terminal would be helpful too.
thanks
|
|
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Location: Toronto
Status:
Offline
|
|
Hi Gavin, I think Apple is already creating a front-end to apache (more than just the start/stop/directory thing we have now). I think this is posted in one of the forums.
That was just a side note, I would also be interested in the answer to your question as well.
[This message has been edited by anothermacguy (edited 12-22-2000).]
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Oct 2000
Location: Arlington, VA
Status:
Offline
|
|
Eric Peyton (Epicware) wrote a WebGrabber, a wrapper for pavuk, a fairly complex command-line utility. He was gracious enough to GPL his work. You can find source and binaries at:
http://www.epicware.com/webgrabber.html
I know of a couple of other examples which escape me at the moment. If I find them, I'll edit this post.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status:
Offline
|
|
Thanks.
WebGrabber is great. it has examples of both sending messages to command line utilities AND displaying the resutls in a textbox (another thing I was looking for)
I'm just doing a simple GUI for apachectl as a learning tool. I thought it would be easy to do as it only has 6 items and there is no interaction needed. (and I've been debugging mod_rewrite rules and I thought a simple restart button would be nifty)
I have it mostly working, it sends all the commands but you have to log in as root and and some of the responses go to the system consle not my textfield.
I am amazed at how easy it is to use cocoa. This is the first thing I have done in OBJ-C / cocoa and I did it in just 4 hours (including learning how) - VERY cool.
the next step is to add user auth along the lines of the sys prefs pannel.
|
|
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Oct 2000
Location: Arlington, VA
Status:
Offline
|
|
Cocoa is definitely cool. I have been researching similar things and have found the Omni Group lists to be extremely helpful. I have not yet joined, but regularly go through the archives. (I'll soon be changing ISPs and am trying to get all my correspondents to send webmail-- don't want to read a high volume list via a browser!!) There was a code sample this month showing how to do the auth panel as well:
http://www.omnigroup.com/mailman/arc...er/006475.html
Good luck!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status:
Offline
|
|
Well, I finished it.
It works great. 'Apache Control' does the following amazing things:
It starts apache
It stops Apache
One Button (patent pending) gracefull restart for easy config file debugging
And if you have 'lynx' it will give you 2, count 'em, two types of status reports!
From a programming point of view it does some neat things:
It gets your root password just like "System Preferences" using the built in netInfo panel. It allows you to execute commmands as root. it takes info returned and puts it in a text box. and it uses several IB tricks for user feedback. All this uses uses examples of code I found from several sources so you don't have to track it all down if you are learning this stuff.
It's a complete interface to a nifty UNIX command line tool and it only took me two days, about half of that time was spent online getting help and learning how to do it. I think this is good news for people worring about the command line ruining the mac way of life. If I can do this over a weekend for fun then GUI front ends for lots of CL tools should pop up soon.
I'll put it on a web site for downloading, source and all, for anyone who wants to take a look.
I'll post a link here when it's ready.
G
|
|
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Status:
Offline
|
|
Most excellent. I'd be quite interested in seeing your source. I've packaged up The Internet Junkbuster and wrote the necessary StartupItems. I'm working on a GUI configuration program, but superuser privileges were going to be a problem. I had intended to do something involving the SETUID bit and password verification with netinfo. Hopefully you have a better solution. If I can get root from within a Cocoa app, I suppose I could write a better installer than the install.sh script I currently have. I'm waiting on a response regarding a license question from the authors of The Internet Junkbuster. As soon as they respond, I'll try and get something out on the web.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status:
Offline
|
|
|
|
|
You can take the dude out of So Cal, but you can't take the dude outta the dude, dude!
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Status:
Offline
|
|
Thanks Gavin. I'm downloading your stuff right now.
|
|
|
| |
|
|
|
 |
|
 |
|
Banned
Join Date: Aug 2006
Status:
Offline
|
|
Hi All.
I know this thread is really old now, but I came across this thread while googling. Is there any possiblility you could repost your code, or email me: giles[dot]williams [at] gmail[dot]com
Thanks.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
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
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|