1. #!/bin/sh
  2. OOO_HOME=/Applications/OpenOffice.org.app/Contents
  3. OOO_HOST=
  4. OOO_PORT="2002 2003 2004 2005"
  5. USER_HOME=/tmp
  6.  
  7. _create_home() {
  8. port=$1
  9. home=${USER_HOME}/user/port${port}
  10. mkdir -p ${home}
  11. echo ${home}
  12. }
  13.  
  14. _start_instances() {
  15. # Go to OOo program folder
  16. cd ${OOO_HOME}/program
  17. # Set IP address
  18. host=${OOO_HOST:-127.0.0.1}
  19. # All ports... default is standard port 2002
  20. for port in ${OOO_PORT:-2002}
  21. do
  22. # Set user home
  23. HOME=$(_create_home ${port})
  24. export HOME
  25. # Start OOo
  26. echo "Starting OpenOffice on ${host}:${port} using home directory ${HOME}"
  27. sock="socket,host=${host},port=${port},tcpNoDelay=1;urp;StarOffice.ServiceManager"
  28. opts="-nologo -nofirststartwizard -nodefault -nocrashreport -norestart -nolockcheck -headless -invisible"
  29. nohup ./soffice -userid="${HOME}" -accept="${sock}" ${opts} 1>soffice_${port}.log 2>&1 &
  30. done
  31. }
  32.  
  33. _start_instances
  34. exit 0