Hypothetical "port load", "port unload" commands (and "turn" script)

Ryan Schmidt ryandesign at macports.org
Tue Nov 20 09:01:58 PST 2007


I've written many replies on this list explaining to people how to  
use launchctl to start and stop various services installed by  
MacPorts. Every time I do, I have to refer back to my notes to  
remember the exact launchctl command and the exact path to the plist.  
Admit it:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.foo.plist

is not easy to remember, and it's a lot to type.


On my system, I wrote a script "turn" to simplify things for me. I  
can say things like:

turn foo on

or

turn off bar

and it knows where to look for the plist and how to execute the  
appropriate launchctl command. It's short and easy to remember. It  
also prints helpful messages if you try to turn something on when  
it's already on, or off when it's already off.


It would be nice to have easier-to-remember commands included with  
MacPorts, but a script called "turn" hardly seems to fit in with the  
rest of the project. But what about:

sudo port load foo

and

sudo port unload bar

? That's pretty easy to remember in my opinion. What do you think?


This proposed syntax limits us to one launchctl plist per port.  
However, we already have that limit, so I don't consider it a big  
problem at this time.


P.S: I'm including my "turn" script for others to examine and try out  
and even use, if they like. But I'm not suggesting that this script  
be incorporated as-is into MacPorts. I would fully intend for the  
hypothetical "port load" and "port unload" commands to be properly  
implemented in Tcl.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: turn
Type: application/octet-stream
Size: 1738 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/macports-dev/attachments/20071120/ffef8130/turn-0001.obj


More information about the macports-dev mailing list