Skip to content

Instantly share code, notes, and snippets.

@rbe
Created October 22, 2010 07:16
Show Gist options
  • Save rbe/640091 to your computer and use it in GitHub Desktop.
Save rbe/640091 to your computer and use it in GitHub Desktop.
Start OpenOffice server instance(s), see http://blog.bensmann.com/starting-multiple-openoffice-instances
#!/bin/sh
OOO_HOME=/Applications/OpenOffice.org.app/Contents
OOO_HOST=
OOO_PORT="2002 2003 2004 2005"
USER_HOME=/tmp
_create_home() {
port=$1
home=${USER_HOME}/user/port${port}
mkdir -p ${home}
echo ${home}
}
_start_instances() {
# Go to OOo program folder
cd ${OOO_HOME}/program
# Set IP address
host=${OOO_HOST:-127.0.0.1}
# All ports... default is standard port 2002
for port in ${OOO_PORT:-2002}
do
# Set user home
HOME=$(_create_home ${port})
export HOME
# Start OOo
echo "Starting OpenOffice on ${host}:${port} using home directory ${HOME}"
sock="socket,host=${host},port=${port},tcpNoDelay=1;urp;StarOffice.ServiceManager"
opts="-nologo -nofirststartwizard -nodefault -nocrashreport -norestart -nolockcheck -headless -invisible"
nohup ./soffice -userid="${HOME}" -accept="${sock}" ${opts} 1>soffice_${port}.log 2>&1 &
done
}
_start_instances
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment