Running at boot behind login screen, problems with launchd

Questions and Answers : Macintosh : Running at boot behind login screen, problems with launchd
Message board moderation

To post messages, you must log in.

AuthorMessage
Profile Christian Seti (user)
Avatar

Send message
Joined: 31 May 99
Posts: 38
Credit: 73,899,402
RAC: 62
Australia
Message 727808 - Posted: 19 Mar 2008, 4:58:51 UTC
Last modified: 19 Mar 2008, 5:08:24 UTC

Problem: Attempting to launch BOINC as a daemon (service) under Leopard using launchd causes an odd hang in the BOINC process.

The fine print:

Those of us interested in running BOINC on large numbers of Mac computers which spend a deal of time parked at the login screen will be familiar with instructions floating around out there to run BOINC as a service.

Unfortunately, these instructions were based on Tiger. Here's some advice (and a question) for those hoping to do the same in Leopard.

The advice for Tiger involves downloading the command line only version of BOINC for Macs and then placing a startup script in the /Library/StartupItems folder. This script would contain a line similar to:

nohup /Library/BOINC/boinc -insecure -allow_remote_gui_rpc -dir /Library/Application\\ Support/BOINC\\ Data/ >> /Library/BOINC/boinc_run.log &


All well and good. This has worked well for us and our Tiger based Lab Macs. The BOINC process starts at boot, and runs behind the login screen. Additionally, you may care to create login and logout scripts for your users to either renice or suspend/resume BOINC so as to minimise any user disruption.

Although launchd was introduced and functional in Tiger, the /Library/StartupItems path to launching BOINC (which isn't launchd based) worked. If you try the same thing in Leopard, it won't work. Any script in this directory is ignored. It seems that launchd is now the only option for launching BOINC as a service in Leopard.

I downloaded Lingon (google it, easy to find), which is a free GUI interface for launchd for Macs. I created a new user daemon to launch BOINC at boot (stored in /Library/LaunchDaemons), which basically pointed launchd to the same script I was using to launch BOINC under Tiger.

Unfortunately, this isn't working for Leopard based Macs, at least not for me.

The launchd script indeed invokes the 'boinc' command line process, but instead of this then spawning an instance of the setiathome process and then settling down act as a low-cpu-using managing process for BOINC while the setiathome process does the heavy lifting, 'boinc' itself takes up nearly 100% CPU, no setiathome process is spawned, and no work is done.

Oddly, if I log in as root, kill the hanging "boinc" process and then run exactly the same script from a command line, then BOINC fires up just fine and spawns the setiathome process and all is well.

Something about launchd invoking boinc is breaking it. When a user is actually logged in and the process is run, it works.

If anyone can offer some help, I'd appreciate it.
---------------------------------
Nathan Zamprogno
http://baliset.blogspot.com
ID: 727808 · Report as offensive
Profile Christian Seti (user)
Avatar

Send message
Joined: 31 May 99
Posts: 38
Credit: 73,899,402
RAC: 62
Australia
Message 727815 - Posted: 19 Mar 2008, 5:57:42 UTC

SOLVED!

I was trying to do my own finangling to get a launchd script up and running.

It turns out that Charlie Fenton's own "Make_BOINC_Service.sh" script works well and fixes this problem.

I note two differences from my own invocation: one is the use of the switch "-daemon" in the command line version of the BOINC core client, and the other is a difference in the way redirection to the BOINC Data directory is facilitated if (as in our case), the core client and the data directory are separate.

Follow the instructions in the "Make_BOINC_Service.sh" file. If only I had done that first!

I can confirm that BOINC DOES run as a daemon, behind the login screen, under OS 10.5.2
---------------------------------
Nathan Zamprogno
http://baliset.blogspot.com
ID: 727815 · Report as offensive

Questions and Answers : Macintosh : Running at boot behind login screen, problems with launchd


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.