Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

launchctl: How to restart a service

For example: squid


I tried google: no relevant results on the first pages


I tried this forum: a single unanswered question


After ps ax|grep squid, I tried "/opt/local/etc/LaunchDaemons/org.macports.Squid/Squid.wrapper stop": error messages (except for the first time), and no effect


I tried launchctl stop org.macports.Squid: no effect at all


I tried killall squid: the main process is still running


I killed the main process: still running


I killed it with -9: no longer running, a new squid is starting


I don't think kill -9 is the proper way to restart services. What is it? In "tradiional" Linux, it's simply "/etc/init.d/whatever restart" (don't know about systemd)

MacBook Pro with Retina display, OS X Mountain Lion (10.8.3)

Posted on Apr 30, 2013 5:44 PM

Reply
10 replies

May 1, 2013 3:25 AM in response to Frank Caggiano

Yes, I followed the man page. That is why I used "stop".


Yes, unload really stops it. For squid, it takes some time, but this is expected.


Does "unload" affect the permanent configuration? As in, if I boot without using load first, will squid still start? The launchd.conf files are empty.


The .plist files are in /Library/Launch*/ , at least some of them.


So the proper "canonical" way to "stop" or "restart" any service is NOT any start and stop command (as per the man page), but "unload" and "load"?

May 1, 2013 5:16 AM in response to Frank Caggiano

Thanks for the responses.


So far I relied on macports and others to set up the .plists and used Lingon to further configure automatic start/stop on boot and shutdown.


Only for bincimap I cloned a .plist (for inetd-like mode), I haven't tried if it really works, but the imap port is open.


My question was for one-time "restart" and temporary "stop" actions that should not have a permanent effect. I do this for config file changes, as some servers really require a restart (Linux's /etc/init.d/service reload is not sufficient) and there are too many different "reload" ways per server to remember them in the absence of a standard "reload" action.

May 1, 2013 9:00 AM in response to Frank Caggiano

Yes, even the (so far) most relevant result leaves out any comment on the question not only once, but twice, as it is about configuring, not restarting. On an older OS, not ML.


The only relevant result will be this thread 😉


Results for anything else than the specific OS versions are also usually useless, as they deal with things that are obsolete, deprecated or simply not there. So any searches must probably include "mountain lion" or something like that.

launchctl: How to restart a service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.