launchd

How can I make a program start up automatically in OSX?

I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google, I read that I can create a .profile file in my user's home folder, and that will execute ...

Shell Script doesn't run automatically though it is registered in Mac OS X Login Items

I have the following shell script registered in my "Login Items" preferences but it does not seem to have any effect. It is meant to launch the moinmoin wiki but only works when it is run by hand from a terminal window, after which it runs until the machine is next shut down. #!/bin/bash cd /Users/stuartcw/Documents/Wiki/moin-1.7.2 /usr...

Does anyone use BetterAuthorizationSample?

On OS X privileged operations are done through AuthorizationExecuteWithPrivileges() around which Apple published two recommendations: The old MoreAuth using setuid helper tools. The current BetterAuthorizationSample littering the system with launchd files. I don't know any applications using the latter... ...

Stop launchd task When App is Opened

Hi Everyone: I'm wondering if there is some way I can stop a launchd task when a application is open, and then start it again when the application is closed. My launchd task is set to be notified when a file is changed and then do some UNIX code with the file. However, my application makes a lot of changes to this file so I can't have...

Cocoa Distributed Objects, Long Polling, launchd and "Not Responding" in Activity Monitor

Scenario: I have a Distributed-objects-based IPC between a mac application and a launchd daemon (written with Foundation classes). Since I had issues before regarding asynchronous messaging (e.g. I have a registerClient: on the server's root object and whenever there's an event the server's root object notifies / calls a method in the c...

Calling system("open <app name.app>") sometimes causes app to be launched as root

I've got an application (A daemon inside /Library/StartupItems to be precise) running as root that occasionally launches another process using system("open /Applications/MyAppName.app"). This works fine except that on certain computers MyAppName gets launched running as root, instead of under the current user. I'm trying to figure out w...

How do I secure a per user GUI launchd agent against a non admin user disabling it?

I have a pair of launchd daemons, one of which is a true daemon (runs as root) and one of which is a GUI agent that runs as a per GUI session basis (session type Aqua). I need to prevent non admin level users from disabling the user level agent using launchctl, or at the very least figure out how to reload the agent from the root level ...

Starting/stopping a launchd agent for all users with GUI sessions.

I need to be able to start/stop a per-session GUI agent from a root level daemon. Similar issues are discussed here, here and here. What I want to be able to do is basically for num in `ps ax | grep [s]bin/launchd | cut -c 1-5`; do if [ $num -ne 1 ]; then sudo launchctl bsexec $num launchctl (un)load -S Aqua /Libra...

Is a launchd daemon the best route to go for reading/writing to privileged files in Cocoa?

I have an application which needs to be able to write to Any User/Current host preference files (which requires admin privileges per Preferences Utilities Reference) and also to enable/disable a launchd agent via its plist (writable only by root). I'm using SFAuthorizationView to require users to authenticate as an admin before alterin...

Launchd Relaunch App on Quit

Hi Everyone: I am wondering how to set Launchd to relaunch my app if the user has not chosen to choose "Quit" from the top bar. There are cases where something may happen to the app, and it may force quit, and if a preference is selected I want it to relaunch automatically. I have looked into it before posting here, and I have heard t...

Launchd PLIST Not Running

Hi Everyone: I am attempting to run an Applescript inside a launchd plist, but for some reason it just isn't working. It could be that it is my computer, but I am thinking that there may be something else wrong with it. If someone could take a look and comment on this post, I would really appreciate it! <?xml version="1.0" encoding="...

VERY simple Launchd plist not running my script...

Hello everyone, I'm trying to figure out why my launchd script is not working. It is extremely simple, but I am new to the mac environment and trying to get accustomed. Here's my plist. I know ProgramArguments is required, so I just put the script path in there... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//...

LaunchAgent - Is there something like RunAtScreenSaver?

Hi, I am looking for a way to execute my app (it's a background task) at times, where the machine is "idle". A good incident would be when the screensaver launches. I already read the manual auf launchd and already use a LaunchAgent to lauch my app at certain intervals, but I found nothing that might help me launching my app when the sc...

What folder should my application write its launchd file?

I am trying to write a small Cocoa application that helps me manage my time, I want it check on startup if already has a launchd entry and if not, add itself an entry. What is the correct folder to write the launchd file, and/or is there a special cocoa method to retrieve what the correct folder is (ie in the same way you retrieve the u...

iPhone SDK strange console message launchd_core_logic.c

Hi, I am running release version of the app on the iPhone, it works fine. There is no error messages in the XCode debugger: Running… Switching to thread 11779 Switching to thread 11779 sharedlibrary apply-load-rules all (gdb) continue Switching to thread 12291 Switching to thread 11779 Switching to thread 13059 Debugger stopped. Progr...

Start Delayed Job on Mac Reboot / Startup

I've got a simple app deployed to a Mac mini running 10.5.8 How would I go about restarting the Delayed Job worker anytime the computer is restarted? ...

Automatic timeout for launchd jobs

I have a launchd job that I've configured to run my unit tests. Every now and then, the unit tests will hang (usually because of some bad code). I know that my test usually only take a couple minutes to run. When they do hang, I usually don't notice it for about an hour, at which point I have to pop open Activity Monitor and forcibly ...

setven in launchd.conf on mac

Hello good people This is my first real development with the mac os(OS X 10.5.8).I got a macbookpro from work and i'm still setting up the right development environment.I've opted for the creation of /etc/launchd.conf and it's working fine for most of my librairies (JAVA_HOME, JRE_HOME) i now need to add CATALINA_OPTS=-Duser.timezone=Asi...

Launchd job running every minute

I am attempting to write a launchd script that runs once a day, on weekdays only. But once I load the script, it runs every minute instead of just on-schedule. This happens whether I load the script as myself or as superuser: launchctl load ~/Library/LaunchAgents/org.myname.foojob or sudo launchctl load /Library/LaunchDaemons/org.myna...

How to load system-wide daemons on MacOS

I'm trying to load my daemon-app with this command launchctl load /Library/LaunchDaemons/myPlistFileName It works fine, but only while my user is logged in on system. How can i load my deamon-app, which will stay loaded without any user logged into the system (like the windows-services)?? The command sudo launchctl load /Library/Launch...