I am getting a file leak descriptors in Jenkins when trying to launch ios-sim using the shell. Something I should mention is that I changed the user of Jenkins to my user away from the initially installed "/Users/Shared/Jenkins" location. Here's the message
./ios-sim launch /Users/me/Desktop/tmp/iOS.app --sdk 6.0 --family iphone
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more
The link states it may be due to not being able to detect the EOF. If so how can point Jenkins to write to "stdin/stdout/stderr"?
Is it a matter of chowning some files that I may of missed when I moved the "/User/Shared/Jenkins/Home" location to /Users/me/Jenkins/Home and the "/Applications/Jenkins/jenkins.war" file to "/User/me/Applications/jenkins.war" ?
In addition to those moves I updated the org.jenkins-ci.plist as follows:
<plist version="1.0">
<dict>
<key>StandardOutPath</key>
<string>/var/log/jenkins/jenkins.log</string>
<key>StandardErrorPath</key>
<string>/var/log/jenkins/jenkins.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>JENKINS_HOME</key>
<string>/Users/me/Jenkins/Home</string>
</dict>
<key>GroupName</key>
<string>staff</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.jenkins-ci</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Library/Application Support/Jenkins/jenkins-runner.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>me</string>
<key>SessionCreate</key>
<true />
</dict>
</plist>
I'm using Jenkins version 1.499
And here is the jenkins.log error:
WARNING: Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
java.lang.Exception
at hudson.Proc$LocalProc.join(Proc.java:329)
at hudson.Launcher$ProcStarter.join(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:91)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:592)
at hudson.model.Run.execute(Run.java:1543)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
"Insane in the membrane" why is it advertised everywhere to stop start and stop jenkins using:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
???? Who wants to edit the jenkins-runner.sh or the add values to the .plist file???? boooo
The secret is in the secret user jenkins created upon install in the "/Users/me/.jenkins" location.
You need to own all the processes and in order to that just locate the jenkins.war file and launch it like so:
nohup java -jar ~/.jenkins/jenkins.war --httpPort=8080
Suddenly everything starts working under the user on your company machine!
enjoy
Related
I'm in the trying to learn a bit more about launchd and how I can use it to automate some tasks. For some reason when my very simple example job runs it exits with status code 126. I have changed permissions on all of my files to ensure I wasn't the issue (as 126 codes usually have something to do with permissions), but the issue persists.
/Library/LaunchDaemons/test.plst
<?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>test.monday</string>
<key>Program</key>
<string>/Users/philliptroutman/Desktop/test.sh</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>20</integer>
</dict>
</plist>
/Users/philliptroutman/Desktop/test.sh
#! /bin/sh
echo 'some data' >> /Users/philliptroutman/Desktop/examplefile.txt
echo "some random echo!"
After I load and unload the plst file this is what I get
launchctl unload /Library/LaunchDaemons/test.plist
launchctl load /Library/LaunchDaemons/test.plist
launchctl list | grep test.monday
- 126 test.monday
I guess my question is very simple... why isn't this working?
I was having the same problem with launchd plists that executed from my ~/Documents/scipts folder. The odd think is, they ran fine from a Google Drive folder Documents were linked to but on machines that just had my regular ~/Documents/scripts, they'd fail with error 126. Apple has designated ~/Documents Desktop and Downloads as private directories. Launchd cannot execute scripts from them.
Move the scripts do a different directory like ~/Library/scripts
You can always softlink them back to wherever you expected to find them.
i have a problem when i run LaunchDaemons this is my .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>com.startup</string>
<key>ProgramArguments</key>
<array>
<string>/Users/myuser/project/workspace/tomcat/run/tomcat-
exp.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WatchPaths</key>
<array>
<string>/Users/myuser/project/workspace/tomcat/log/exp.out</string>
</array>
</dict>
</plist>
and this is the error am getting, i have been trying to solve this issue for hours but no suceess :(
when i checked system log this is what i found:
16239 Dec 28 21:36:29 myyser MRT[1481]: Error: SMJobRemove: The
operation couldn’t be completed. (CFErrorDomainLaunchd error 2.)
16240 Dec 28 21:36:29 myuser com.apple.xpc.launchd[1]
(com.apple.mrt[1481]): Service exited with abnormal code: 2
16241 Dec 28 21:36:29 myuser com.apple.xpc.launchd[1] (com.apple.mrt):
Service only ran for 0 seconds. Pushing respawn out by 10 seco
nds.
Your plist looks running shell script. Exit code 127 is reported when command is not found, usually $PATH is not correct or just by typo.
Other than that, your plist looks ok though I have only used OnDemand, and I haven't run script.
What I usually do to debug daemons is to run them from command line
# /bin/launchctl load /Library/LaunchDaemons/mydaemon.plist
and see debug messages by fprintf on shell. You can redirect your stdout by adding
<key>StandardOutPath</key>
<string>/var/log/mylog.log</string>
to your .plist. Does your daemon work w/o any issue when started by command line manually ?
See this link for exit codes of scripts of bash.
We also had the same problem with error 127. However in our case we tried to use a symbolic inside a plist file running a peerJs server which was causing the problem discussed here
Avoid using a symbolic link inside a launch daemon file and use real path to a specific file
After brew install varnish I would like to chenge some options in config file for example DAEMON_OPTS unfortunetlly I can't find this file.
In linux it is in folders:
Ubuntu: /etc/default/varnish
CentOS 6.x: /etc/sysconfig/varnish
CentOS 7.x: /etc/varnish/varnish.params
Where can I find it on OSX?
I am not familiar with the varnish package myself, but if you run:
brew info varnish
it tells you a load of ancillary info, and amongst that, it tells you how to manually start it and reveals the config file location:
/usr/local/sbin/varnishd -n /usr/local/var/varnish -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080 -F
So, I assume the file you are looking for is:
/usr/local/etc/varnish/default.vcl
Note that brew info varnish (as shown above) doesn’t require you to have that package installed.
If you do have it installed, you can use the following to see all the files belonging to that package, and thereby find the config file:
brew ls varnish
Note that brew info varnish doesn't always tell you all files, to be maximally sure of getting a complete list of files associated with a package, use the -verbose flag:
brew ls varnish -verbose
Sample Output
/usr/local/Cellar/varnish/5.2.1/.bottle/etc/varnish/default.vcl
/usr/local/Cellar/varnish/5.2.1/.brew/varnish.rb
/usr/local/Cellar/varnish/5.2.1/bin/varnishadm
/usr/local/Cellar/varnish/5.2.1/bin/varnishhist
/usr/local/Cellar/varnish/5.2.1/bin/varnishlog
/usr/local/Cellar/varnish/5.2.1/bin/varnishncsa
/usr/local/Cellar/varnish/5.2.1/bin/varnishstat
/usr/local/Cellar/varnish/5.2.1/bin/varnishtest
/usr/local/Cellar/varnish/5.2.1/bin/varnishtop
/usr/local/Cellar/varnish/5.2.1/ChangeLog
/usr/local/Cellar/varnish/5.2.1/homebrew.mxcl.varnish.plist
/usr/local/Cellar/varnish/5.2.1/include/varnish/cache/cache.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/cache/cache_backend.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/cache/cache_director.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/cache/cache_filter.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/common/com_params.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/common/common.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/common/common_vsm.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/miniobj.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/acct_fields_bereq.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/acct_fields_req.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/backend_poll.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/ban_vars.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/bo_flags.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/boc_state.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/body_status.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/cli_cmds.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/debug_bits.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/feature_bits.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/h2_error.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/h2_frames.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/h2_settings.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/h2_stream.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/http_headers.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/http_response.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/locks.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/obj_attr.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/oc_exp_flags.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/oc_flags.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/params.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/req_body.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/req_flags.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/sess_attr.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/sess_close.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/steps.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/symbol_kind.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vcc_types.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vcl_returns.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vhd_fsm.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vhd_fsm_funcs.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vhd_return.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vhp_huffman.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vhp_static.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vrt_stv_var.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vsc_levels.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vsl_tags.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/vsl_tags_http.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/tbl/waiters.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vapi_options.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/voptget.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vsc.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vsc_int.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vsl.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vsl_int.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vapi/vsm.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vas.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vav.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vbm.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vcl.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vcli.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vcs.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vdef.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vmod_abi.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vqueue.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vre.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vrnd.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vrt.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vrt_obj.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vsa.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vsb.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vsha256.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vtcp.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vtim.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vut.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/vut_options.h
/usr/local/Cellar/varnish/5.2.1/include/varnish/waiter/waiter.h
/usr/local/Cellar/varnish/5.2.1/INSTALL_RECEIPT.json
/usr/local/Cellar/varnish/5.2.1/lib/libvarnishapi.1.dylib
/usr/local/Cellar/varnish/5.2.1/lib/libvarnishapi.dylib
/usr/local/Cellar/varnish/5.2.1/lib/pkgconfig/varnishapi.pc
/usr/local/Cellar/varnish/5.2.1/lib/varnish/vmods/libvmod_blob.so
/usr/local/Cellar/varnish/5.2.1/lib/varnish/vmods/libvmod_directors.so
/usr/local/Cellar/varnish/5.2.1/lib/varnish/vmods/libvmod_purge.so
/usr/local/Cellar/varnish/5.2.1/lib/varnish/vmods/libvmod_std.so
/usr/local/Cellar/varnish/5.2.1/lib/varnish/vmods/libvmod_vtc.so
/usr/local/Cellar/varnish/5.2.1/LICENSE
/usr/local/Cellar/varnish/5.2.1/README.rst
/usr/local/Cellar/varnish/5.2.1/sbin/varnishd
/usr/local/Cellar/varnish/5.2.1/share/aclocal/varnish-legacy.m4
/usr/local/Cellar/varnish/5.2.1/share/aclocal/varnish.m4
/usr/local/Cellar/varnish/5.2.1/share/doc/varnish/builtin.vcl
/usr/local/Cellar/varnish/5.2.1/share/doc/varnish/example.vcl
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishadm.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishd.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishhist.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishlog.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishncsa.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishstat.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishtest.1
/usr/local/Cellar/varnish/5.2.1/share/man/man1/varnishtop.1
/usr/local/Cellar/varnish/5.2.1/share/man/man3/vmod_blob.3
/usr/local/Cellar/varnish/5.2.1/share/man/man3/vmod_directors.3
/usr/local/Cellar/varnish/5.2.1/share/man/man3/vmod_purge.3
/usr/local/Cellar/varnish/5.2.1/share/man/man3/vmod_std.3
/usr/local/Cellar/varnish/5.2.1/share/man/man3/vmod_vtc.3
/usr/local/Cellar/varnish/5.2.1/share/man/man7/varnish-cli.7
/usr/local/Cellar/varnish/5.2.1/share/man/man7/varnish-counters.7
/usr/local/Cellar/varnish/5.2.1/share/man/man7/vcl.7
/usr/local/Cellar/varnish/5.2.1/share/man/man7/vsl-query.7
/usr/local/Cellar/varnish/5.2.1/share/man/man7/vsl.7
/usr/local/Cellar/varnish/5.2.1/share/man/man7/vtc.7
/usr/local/Cellar/varnish/5.2.1/share/varnish/vcl/devicedetect.vcl
/usr/local/Cellar/varnish/5.2.1/share/varnish/vmodtool.py
/usr/local/Cellar/varnish/5.2.1/share/varnish/vsctool.py
When macOS starts daemons via launchd and launchctl it generally uses a plist file to configure the options with which daemons should be started, so you may actually be looking for this file for setting daemon options:
/usr/local/Cellar/varnish/5.2.1/homebrew.mxcl.varnish.plist
which looks like this:
<?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>homebrew.mxcl.varnish</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/varnish/sbin/varnishd</string>
<string>-n</string>
<string>/usr/local/var/varnish</string>
<string>-f</string>
<string>/usr/local/etc/varnish/default.vcl</string>
<string>-s</string>
<string>malloc,1G</string>
<string>-T</string>
<string>127.0.0.1:2000</string>
<string>-a</string>
<string>0.0.0.0:8080</string>
<string>-F</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/usr/local</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/varnish/varnish.log</string>
<key>StandardOutPath</key>
<string>/usr/local/var/varnish/varnish.log</string>
</dict>
</plist>
I am currently using a plist to run a shell script.
<?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>com.name.set</string>
<key>Program</key>
<string>/Users/username_here/Desktop/simple.sh</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>5</integer>
<key>StandardErrorPath</key>
<string>/tmp/com.name.example.stderr</string>
<key>StandardOutPath</key>
<string>/tmp/com.name.example.stdout</string>
</dict>
</plist>
This works! But when I change the program name to be
<string>/Desktop/simple.sh</string>
it doesn't run the script. also ~/Desktop/simple.sh does not work.
Is there a way to run the script without knowing the username and using an absolute path?
I am also getting this error message when I tail launchd.
com.apple.xpc.launchd[1] (com.name.example[8178]): Service could not initialize: 14F27: xpcproxy + 13421 [1402][AD0301C4-D364-31CE-8BA7-B5DBECE64D0A]: 0x2
Thanks!
Using a shell as arg0 and giving it a path relative to the user's home folder works for me:
<key>ProgramArguments</key>
<array>
<string>zsh</string>
<string>-c</string>
<string>~/CLI/scripts/list_open_jira_tickets --skip=5297 > ~/CLI/tmp/open_jira_tickets.txt</string>
</array>
If daemon is run as a per-user agent (installed in ~/Library/LaunchAgent) you can use a period get the relative path. Which would be the home folder (~/)
So you can do this:
<key>Program</key>
<string>./Desktop/simple.sh</string>
It might be nicer to save your program next to your plist:
./Library/LaunchAgents/simple.sh
I have a application run as a daemon. I put the application plist under under /Library/LaunchDaemons on iOS 8 device, and launch it by executing the command
launchctl load /Library/LaunchDaemons/com.mycompany.testapp.plist
In my laumchd plist Note that the application is running as a daemon by executing the command
I would like to make this application restart only when it is crash or is killed. If I intentionally exit it with code 0, I don't want it to restart. I've tried the below configuration. This does work on iOS 7, but do NOT work on iOS 8.
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>
Thus I tried adding another key StartInterval which's set as 10.
<key>StartInterval</key>
<integer>10</integer>
I tested this scenario by exit with code 0 and by kill my application with command kill -9 [PID]. This key makes my application to start again after 10 seconds after being killled. However, I have a concern about the result of this key while my application is running.
Does this key have an affect on the started and running application. I've monitored the log, seem StartInterval key do nothing with the running daemon. However, I'm quite not sure about it. Could you explain more information about it? Thank you very much.
According to this link http://pitaya.ch/documentation/iOS8_0APIDiffs.html all traces to launchd in the headers have disappeared. (search for /usr/include/launch.h, so you see it was removed)
Seems because the moved to new libxpc as base for launchd (see last slide in http://technologeeks.com/docs/launchd.pdf).
Seems like they changed launchd behaviour in iOS 8. Of Apple's own LaunchDaemons (located under /System/Library/LaunchDaemons/) some also have a KeepAlive-property in Dictionary format. If you kill them, they are respawned by launchd instantly.
But after some testing the only way to have KeepAlive-property working, is to add either add LaunchEvents (see slide 21ff in http://technologeeks.com/docs/launchd.pdf) and/or MachServices to the plist or to change the KeepAlive-property to:
<key>KeepAlive</key>
<true/>
But then there is NO way to kill your deamon without launchd respawning it, aside from executing launchctl unload /Library/LaunchDaemons/com.mycompany.testapp.plist.
My working 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>Program</key>
<string>/path/to/your/daemon</string>
<key>RunAtLoad</key>
<true/>
<key>Label</key>
<string>com.mycompany.testapp</string>
<key>EnablePressuredExit</key>
<false/>
<key>UserName</key>
<string>root</string>
<key>JetsamProperties</key>
<dict>
<key>JetsamPriority</key>
<integer>-49</integer>
<key>JetsamMemoryLimit</key>
<integer>10000</integer>
</dict>
<key>POSIXSpawnType</key>
<string>Adaptive</string>
<key>Disabled</key>
<false/>
<key>ThrottleInterval</key>
<integer>5</integer>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
<key>Crashed</key>
<true/>
</dict>
<key>MachServices</key>
<dict>
<key> com.mycompany.testapp.someMachService</key>
<true/>
</dict>
<key>EnableTransactions</key>
<false/>
<key>LaunchEvents</key>
<dict>
<key>com.apple.notifyd.matching</key>
<dict>
<key>SignificantTimeChangeNotification</key>
<dict>
<key>Notification</key>
<string>SignificantTimeChangeNotification</string>
</dict>
<key>SomeMoreNotifications</key>
[...]
</dict>
</dict>
</dict>
</plist>
About the StartInterval-property: Even Apple has this property in addition to the KeepAlive-property for some important daemons (e.g. com.apple.locationd) and they seem running just fine. So I don't think you have to worry...
Use false with SuccessfulExit key.
SuccessfulExit
If true, the job will be restarted as long as the program exits and with an exit status of zero.
If false, the job will be restarted in the inverse condition. This key implies that "RunAtLoad"
is set to true, since the job needs to run at least once before we can get an exit status.