From: SourceForge.net <no...@so...> - 2008-06-27 15:17:11
|
Feature Requests item #1618362, was opened at 2006-12-18 12:15 Message generated for change (Settings changed) made by markm68k You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=361118&aid=1618362&group_id=11118 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Other platform integration Group: None >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Use launchd instead of a StartupItem on OSX Initial Comment: StartupItems are deprecated as the launch method for daemons on OSX versions 10.4 and above, and don't integrate into the system's standard method of managing daemons using launchd and the launchctl(1) & service(8) commands. The installer package should contain a /Library/LaunchDaemons/org.privoxy.ijbswa.plist file, and the /Library/StartupItems/Privoxy directory should be removed. Failing this, at least use the more manageable and not entirely deprecated xinetd instead of a StartupItem ---------------------------------------------------------------------- Comment By: mark miller (markm68k) Date: 2008-06-27 08:13 Message: Logged In: YES user_id=1998998 Originator: NO since the original post, there is a new and improved StartupItem and LaunchDaemon in the "macsetup" in cvs. it requires a privoxy user and group to be created on your mac. please try it out and let us know if it works for you. ---------------------------------------------------------------------- Comment By: Etienne Samson (etiennes) Date: 2008-06-27 02:50 Message: Logged In: YES user_id=735276 Originator: NO I'll try taking a look at it. I have a working on-demand config file, but it requires some source-tweaking to privoxy, because the launchd.plist(5) man states that "The job must check-in to get a copy of the file descriptors using APIs outlined in launch(3).". More info on this later (if you could comment on where I should look to make those changes, it will make my task easier ;-)). ---------------------------------------------------------------------- Comment By: guardian34 (guardian34) Date: 2007-12-12 15:06 Message: Logged In: YES user_id=1056433 Originator: NO > I'm sure how well those .commands would work if I meant to say "I'm not sure ..." > In any event, launchd is not the hold-up - getting a 10.5-friendly installer is. I was looking to that, but I was unsure about how to check for or make a privoxy user. (Unsure on 10.5, let alone 10.4 or whatever else is supported.) ---------------------------------------------------------------------- Comment By: guardian34 (guardian34) Date: 2007-12-12 14:58 Message: Logged In: YES user_id=1056433 Originator: NO > It seems like the "--no-daemon" flag is a requirement. Agreed. > <string>--pidfile /var/run/privoxy.pid</string> This gave me usage errors. After separating the arguments, I had permission error on the /var location, so I wrote the file to Privoxy's log folder instead. This seems to work on Mac OS X 10.5.1... /Library/LaunchDaemons/org.privoxy.ijbswa.plist ~~ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.privoxy.ijbswa</string> <key>OnDemand</key> <true/> <key>ProgramArguments</key> <array> <string>/Library/Privoxy/privoxy</string> <string>--no-daemon</string> <string>--pidfile</string> <string>/Library/Privoxy/Logs/privoxy.pid</string> <string>config</string> </array> <key>RunAtLoad</key> <false/> <key>UserName</key> <string>_privoxy</string> <key>WorkingDirectory</key> <string>/Library/Privoxy</string> </dict> </plist> ~~ Start Privoxy.command ~~ #!/bin/sh PID=`ps -axc | grep 'privoxy$' | grep -v grep | awk '{ print $1 }'` if [[ $PID != '' ]]; then echo "Privoxy is already running. ($PID)" exit 0 fi RUNATLOAD=`defaults read /Library/LaunchDaemons/org.privoxy.ijbswa RunAtLoad` if [[ $RUNATLOAD = '1' ]]; then sudo launchctl load /Library/LaunchDaemons/org.privoxy.ijbswa.plist else sudo launchctl start org.privoxy.ijbswa fi echo 'Privoxy started.' ~~ Stop Privoxy.command ~~ #!/bin/sh PID=`ps -axc | grep 'privoxy$' | grep -v grep | awk '{ print $1 }'` if [[ $PID = '' ]]; then echo 'Privoxy was not running.' exit 0 fi RUNATLOAD=`defaults read /Library/LaunchDaemons/org.privoxy.ijbswa RunAtLoad` if [[ $RUNATLOAD = '1' ]]; then sudo launchctl unload /Library/LaunchDaemons/org.privoxy.ijbswa.plist else sudo launchctl stop org.privoxy.ijbswa fi echo 'Privoxy was stopped.' ~~ I'm sure how well those .commands would work if "OnDemand" was set to false... ---------------------------------------------------------------------- Comment By: John Daniel (etresoft) Date: 2007-12-12 04:39 Message: Logged In: YES user_id=382372 Originator: NO OK. Yet another new 10.5 feature to learn. The Apple docs continue to say: "You should use the new property unless you need to support Mac OS X 10.4.x". I would like to enable launchd under Tiger as well, but it isn't a requirement. I'm still working on getting a new installer built that supports 10.4 and 10.5. The changes between 10.4 and 10.5 are larger than those between 10.3 and 10.4, so the installer package needs a bit of work. Here is what I have for a launchd config file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.ijbswa.privoxy</string> <key>ProgramArguments</key> <array> <string>/Library/Privoxy/privoxy</string> <string>--no-daemon</string> <string>--pidfile /var/run/privoxy.pid</string> <string>config</string> </array> <key>WorkingDirectory</key> <string>/Library/Privoxy</string> <key>UserName</key> <string>privoxy</string> <key>RunAtLoad</key> <true/> </dict> </plist> I don't know if it works or not. It seems like the "--no-daemon" flag is a requirement. Apples says "Keep in mind that, regardless of how it interacts with launchd, a launchd daemon must not daemonize itself; doing so would undermine launchd's ability to monitor the daemon." In any event, launchd is not the hold-up - getting a 10.5-friendly installer is. But when all is ready, I would really like it if Privoxy could "play nice" and only run when the user needs it. I would also like to have a Preference Pane to control it and a real uninstaller, but those last two are "nice-to-have"s. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2007-12-11 20:15 Message: Logged In: NO I believe "OnDemand" is actually related to "KeepAlive". > OnDemand <boolean> > This key was used in Mac OS X 10.4 to control whether a job was kept > alive or not. The default was true. This key has been deprecated and > replaced in Mac OS X 10.5 with the more powerful KeepAlive option. I haven't tried it, but I think you could remove (or set to false) the "RunAtLoad" key and then use `launchctl` to start and stop it: sudo launchctl start org.privoxy.ijbswa sudo launchctl stop org.privoxy.ijbswa I'm still trying to figure out all this stuff myself, so let me know how that works for you. ---------------------------------------------------------------------- Comment By: John Daniel (etresoft) Date: 2007-12-11 19:10 Message: Logged In: YES user_id=382372 Originator: NO guardian34, Thanks for the file! If you could figure out how to run Privoxy using "OnDemand" instead of "RunAtLoad", I would be eternally grateful! ---------------------------------------------------------------------- Comment By: guardian34 (guardian34) Date: 2007-12-10 23:04 Message: Logged In: YES user_id=1056433 Originator: NO /Library/LaunchDaemons/org.privoxy.ijbswa.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>org.privoxy.ijbswa</string> <key>ProgramArguments</key> <array> <string>/Library/Privoxy/sbin/privoxy</string> <string>/Library/Privoxy/etc/config</string> </array> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>_privoxy</string> <key>WorkingDirectory</key> <string>/Library/Privoxy</string> </dict> </plist> ---------------------------------------------------------------------- Comment By: John Daniel (etresoft) Date: 2007-10-13 15:29 Message: Logged In: YES user_id=382372 Originator: NO Using launchd is quite a bit more complicated than this. I've tried twice now to get Privoxy running with launchd and failed both times. I supposed if I tried a third time, modified the default config file, ran as root, and used RunAtStart (thereby negating any advantage of launchd over StartupItems), I might be able to get it to run. But that wouldn't be any better than using StartupItem. I'm tired of messing with it for now and I shan't spend any more time on it. If anyone else wants to submit a working launchd config file, I'll be more than happy to integrate it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=361118&aid=1618362&group_id=11118 |