[MarkLogic Dev General] Auto-start MarkLogic at reboot on Mac
Ron Hitchens
ron at ronsoft.com
Fri Jun 22 04:20:41 PDT 2012
Dave,
That is true. If you do something that causes MarkLogic
to exit, you will need to go to the Prefs pane to start it
again. Thereafter it will auto-restart as expected.
This launchd config could also restart it if the LaunchOnlyOnce
key were left out. The problem there is that you can never
stop it, because launchd would re-launch it every time you try
to stop it via the Prefs pane.
This is a one-time start at boot. After that you use the
Prefs panes as before. If someone can figure a way to more
tightly integrate with the Prefs pane, that would be awesome.
On Jun 22, 2012, at 12:03 PM, David Lee wrote:
> I have not tried this yet but if this prevents MarkLogic from automatically restarting you will run into occasional problems. There are certian conditions where the server needs to restart itself (such as changes to some parameters, and initial setup). It does this by simply exiting and assuming the parent will restart it. If you have prevented that then ML will just exit sometimes and you will have to manually restart it.
>
> -----------------------------------------------------------------------------
> David Lee
> Lead Engineer
> MarkLogic Corporation
> dlee at marklogic.com
> Phone: +1 650-287-2531
> Cell: +1 812-630-7622
> www.marklogic.com
>
> This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and delete all copies. Thank you for your cooperation.
>
>> -----Original Message-----
>> From: general-bounces at developer.marklogic.com [mailto:general-
>> bounces at developer.marklogic.com] On Behalf Of Ron Hitchens
>> Sent: Friday, June 22, 2012 3:26 AM
>> To: MarkLogic Developer Discussion
>> Subject: [MarkLogic Dev General] Auto-start MarkLogic at reboot on Mac
>>
>>
>> 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
>>
>>
>>
>>
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://community.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://community.marklogic.com/mailman/listinfo/general
---
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