This page describes how to configure auto-start for Nuxeo server on Mac OS X. You can download the scripts mentioned in the attachments section and modify paths etc accordingly.
1) Create a wrapper script named "nuxeo-launchd.sh" and put it in home bin folder (~/bin).
nuxeo-launchd.sh
nuxeo-launched.sh
#! /bin/sh # nuxeo-launchd.sh # # Wrapper script that starts Nuxeo. This is needed for proper interaction with launchd. #--------------------------------------------------------- # Helper functions #--------------------------------------------------------- # NOTE: We are inheriting NUXEO_HOME from launchd, because its value # was defined in the launchd plist configuration file. export NUXEO_BIN=$NUXEO_HOME/bin export NUXEO_CONF=${NUXEO_BIN}/nuxeo.conf export NUXEO_HOST=127.0.0.1 function shutdown() { # Bye Nuxeo! echo "Shutting down Nuxeo... " $NUXEO_BIN/nuxeoctl stop echo "done." } function startup() { # Let's go! echo "Starting up Nuxeo... " $NUXEO_BIN/nuxeoctl start # Register the shutdown function as callback to execute when a signal # is sent to this process. trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP echo "done." } #--------------------------------------------------------- # Let's go #--------------------------------------------------------- startup while true; do sleep 86400 & wait $! done
Set permission:
chmod +x ~/bin/nuxeo-launchd.sh
Create launchd configuration file:
sudo vim /Library/LaunchDaemons/com.pi.nuxeo.plist
And add the content in the file:
/Library/LaunchDaemons/com.pi.nuxeo.plist
<?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.pi.nuxeo</string> <key>ServiceDescription</key> <string>Nuxeo Server</string> <key>UserName</key> <string>pterobyte</string> <key>GroupName</key> <string>staff</string> <key>EnvironmentVariables</key> <dict> <key>NUXEO_HOME</key> <string>/Users/pterobyte/nuxeo-cap-5.9.3-tomcat</string> </dict> <key>ProgramArguments</key> <array> <string>/Users/pterobyte/bin/nuxeo-launchd.sh</string> </array> <key>StandardOutPath</key> <string>/Users/pterobyte/logs/nuxeo-launchd-stdout.log</string> <key>StandardErrorPath</key> <string>/Users/pterobyte/logs/nuxeo-launchd-stderr.log</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> </dict> </plist>
Now test the launchd scripts: (please stop Nuxeo before the test)
sudo launchctl load /Library/LaunchDaemons/com.pi.nuxeo.plist
Attachments:
References: