#!/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