For my app i want to make a background process so i did.
But now when try to load the process by script in postinst like this
/Library/LaunchDaemons/com.dev.app
.
i am getting error msg:
Could not open job overrides database at: /private/var/db/launchd.db/com.apple.launchd/overrides.plist: 2: No such file or directory
can anyone please help me to get rid of this?
Debian postinst
script:
chown root:wheel /Library/LaunchDaemons/com.dev.app.plist
launchctl load /Library/LaunchDaemons/com.dev.app.plist
I see this error message, too.
If you look on your phone's filesystem (e.g. login with ssh
), I bet you don't have a folder at /private/var/db/launchd.db
.
Just because iOS can't find that database file doesn't mean your daemon isn't loaded (or unloaded). Use the ps -Aef
command at the command line (logged into the phone) to check whether your daemon process is running or not.
Inside your daemon's plist file (e.g. /System/Library/LaunchDaemons/com.mycompany.mydaemon.plist
), you can set a Disabled flag (but, you probably won't). The overrides.plist
file can override the Disabled setting from your daemon's plist file.
My guess is that this is primarily an OS X feature, and not commonly used by iOS, which shares much of the same codebase.
If you really feel the need to get rid of the message, it looks like simply creating that directory will get rid of it. So, you could add something like this in your postinst
script, before calling launchctl
:
mkdir -p /var/db/launchd.db/com.apple.launchd