Hypothetical "port load", "port unload" commands (and "turn" script)
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.
Hi Ryan, On Nov 20, 2007, at 9:01 AM, Ryan Schmidt wrote:
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?
I like this. We could look for a startupitem in the port, get the name, and put the proper command together for launchctl. Very nice. Do we have any other conceivable uses for the words load and unload that this might conflict with? James
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.
<turn>_______________________________________________ macports-dev mailing list macports-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macports-dev
On 20 Nov 2007, at 12:07, James Berry wrote:
Hi Ryan,
On Nov 20, 2007, at 9:01 AM, Ryan Schmidt wrote:
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?
I like this. We could look for a startupitem in the port, get the name, and put the proper command together for launchctl. Very nice. Do we have any other conceivable uses for the words load and unload that this might conflict with?
James
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.
We already have ports that install multiple lauchctl plists per port, although they use upstream provided plists to do so (avahi).
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.
<turn>_______________________________________________ macports-dev mailing list macports-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macports-dev
_______________________________________________ macports-dev mailing list macports-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macports-dev
Randall Wood rhwood@mac.com http://shyramblings.blogspot.com "The rules are simple: The ball is round. The game lasts 90 minutes. All the rest is just philosophy."
On Nov 21, 2007, at 03:34, Randall Wood wrote:
On 20 Nov 2007, at 12:07, James Berry wrote:
On Nov 20, 2007, at 9:01 AM, Ryan Schmidt wrote:
[snip]
sudo launchctl load -w /Library/LaunchDaemons/org.macports.foo.plist
is not easy to remember, and it's a lot to type.
[snip]
It would be nice to have easier-to-remember commands included with MacPorts [...]. [W]hat about:
sudo port load foo
and
sudo port unload bar
? That's pretty easy to remember in my opinion. What do you think?
I like this. We could look for a startupitem in the port, get the name, and put the proper command together for launchctl. Very nice. Do we have any other conceivable uses for the words load and unload that this might conflict with?
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.
We already have ports that install multiple lauchctl plists per port, although they use upstream provided plists to do so (avahi).
avahi is the only one I know of that installs multiple launchctl plists. And it doesn't do so using portfile directives, because the startupitem directives do not support more than one plist per port. So the addition of "port load" needn't affect avahi users; they can continue to use the launchctl commands they're already used to. Or, "port load" could accept an optional additional argument. For example, if we had plists org.macports.foo.client.plist and org.macports.foo.server.plist installed by a hypothetical port foo, then "port load foo" would error out, advising the user to choose client or server. The user could "port load foo client" or "port load foo server".
participants (3)
-
James Berry
-
Randall Wood
-
Ryan Schmidt