[MarkLogic Dev General] Auto-start MarkLogic at reboot on Mac
Ron Hitchens
ron at ronsoft.com
Fri Jun 22 00:25:58 PDT 2012
If you're not using MarkLogic on a Mac, you can stop
reading now.
So I got irritated one too many times after rebooting
my Mac laptop and forgetting to run System Preferences to
start up MarkLogic. So I wrote a launchd definition to
start it up automatically for me (see below).
Copy this XML file into the per-user LaunchAgents directory
under your hime directory: Library/LaunchAgents. If this
directory doesn't exist, create it. Call the script anything
you like as long as it ends with .plist, I used the name
com.marklogic.server.plist which follows Apple's naming
scheme.
Inside the file, replace all instances of "YOURUSERNAME"
with your own home directory name. It's not possible in
a launchd XML descriptor to do variable substitution.
This uses the undocumented -t option when starting MarkLogic.
This prevents ML from forking at startup into a parent watcher
process and a child that does the work. One reason this is
done is so that the child process can run as the marklogic user
rather than root. In this case (because you're using launchd)
the MarkLogic process will run as you anyway. Without using
the -t option, launchd wants to keep respawning the ML process.
This is also set to not restart ML when it exits. After
startup, MarkLogic will be running and you can see it in the
System Preferences panel. You can stop it from there. If you
want to start it again, do it from the preferences pane. It
will start automatically again on the next reboot.
Hopefully you will find this helpful if you're a Mac user.
MarkLogic is welcome (and encouraged) to roll this into the
Mac installer in future versions if they are so inclined.
===========
<?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>Disabled</key>
<false/>
<key>Label</key>
<string>com.marklogic.server</string>
<key>ProgramArguments</key>
<array>
<string>/Users/YOURUSERNAME/Library/MarkLogic/bin/MarkLogic</string>
<string>-t</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>MARKLOGIC_INSTALL_DIR</key>
<string>/Users/YOURUSERNAME/Library/MarkLogic</string>
<key>MARKLOGIC_DATA_DIR</key>
<string>/Users/YOURUSERNAME/Library/Application Support/MarkLogic/Data</string>
<key>MARKLOGIC_PID_FILE</key>
<string>/Users/YOURUSERNAME/Library/Application Support/MarkLogic/Data/MarkLogic.pid</string>
<key>MARKLOGIC_UMASK</key>
<string>022</string>
</dict>
<key>WorkingDirectory</key>
<string>/Users/YOURUSERNAME/Library/MarkLogic</string>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>
---
Ron Hitchens {mailto:ron at ronsoft.com} Ronsoft Technologies
+44 7879 358 212 (voice) http://www.ronsoft.com
+1 707 924 3878 (fax) Bit Twiddling At Its Finest
"No amount of belief establishes any fact." -Unknown
More information about the General
mailing list