Install Openoffice headless as a service in Ubuntu
It's taken me forever to figure out to get this going so now that I've found it out here's the solution (thanks to this post: http://code.google.com/p/openmeetings/wiki/OpenOfficeConverter#Starting_OO_in_headless_with_Version_OpenOffice_3.0_++)
First of all install the headless openoffice from the repositories:
sudo apt-get install openoffice.org-headless openoffice.org-writer openoffice.org-draw
The 2 latter packages are required or you will get an error message: This url is not supported
Now you need to create a script to start it as a service:
sudo nano /etc/init.d/openoffice.sh
Paste the following code into that file:
#!/bin/bash
# openoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
#
OOo_HOME=/usr/bin
SOFFICE_PATH=$OOo_HOME/soffice
PIDFILE=/var/run/openoffice-server.pidset -e
case "$1" in
start)
if [ -f $PIDFILE ]; then
echo "OpenOffice headless server has already started."
sleep 5
exit
fi
echo "Starting OpenOffice headless server"
$SOFFICE_PATH -headless -nologo -nofirststartwizard -accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo "Stopping OpenOffice headless server."
killall -9 soffice && killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo "Openoffice headless server is not running."
exit
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
Exit the nano text editor saving the file as you do.
Now make the script executable:
sudo chmod 0755 /etc/init.d/openoffice.sh
Make it start automatically on reboot by executing this command:
sudo update-rc.d openoffice.sh defaults
Now start the service by running
sudo /etc/init.d/openoffice.sh start
Now all should be good!
- Printer-friendly version
- Login or register to post comments
Book Navigation
- Features
- Users Handbook
- 1.5 User Handbook Contents
- OpenVPMS FAQ
- Various Other Pages
- Editing Lists
- Adding New Users
- Business Continuity Plan Outline
- Create a New Appointment for a New Customer
- Creating And Using Macros
- Document merging with Open Office Writer
- Elements
- Glossary
- How to make it easier to see where the cursor is
- How to use a Report downloaded from the Community: Shared Resources Area
- Introduction to the web application
- Inventory pricing
- Product Dispensing fee
- Searching a patient by microchip number
- The Application Tree
- The customer module
- User Guide
- Video tutorials
- Developer's Handbook
- Implementors Handbook
- Installation Documentation
- Tweaks and customisation
- Upgrade Documentation
- 1.5 Release Implementation Guide




Comments
Disable OpenOffice restart
When starting OpenOffice (OO) outside OpenVPMS, you should also disable OpenVPMS' facility for restarting OO (as a workaround for memory leaks in OO 2.x).
To disable restart, edit applicationContext.xml located in the directory:
<TOMCAT_HOME>/webapps/openvpms/WEB-INF
and change the reuseCount value as follows:
Running OpenOffice 2.x on Ubuntu from Tomcat
OpenOffice 2.x cannot be started by OpenVPMS on Ubuntu without some configuration changes.
Whichever user is used to run OpenOffice, they need to have a writable home directory so that OpenOffice can read/write $HOME/.openoffice.org2
If OpenOffice can doesn't have permission to access this directory, it silently fails - the soffice process will appear in ps listings, but:
will show that no process is listening on port 8100 (the port OpenVPMS configures OpenOffice to listen on).
By default, the /etc/init.d/tomcat5.5 script runs tomcat as user tomcat55 which doesn't have a writable home directory. Also, when it runs tomcat (using jsvc) it doesn't change $USER or $HOME to refer to tomcat55, but leaves them as the same as root. When OpenOffice is started by OpenVPMS in this scenario, it has no permission to access root's home directory, so it silently fails.
To configure Ubuntu to enable OpenVPMS to start/stop OpenOffice do the following:
1. Make the tomcat55 user home directory writable by tomcat55.
2. Change /etc/init.d/tomcat5.5 to set USER and HOME to that of tomcat55
# Run Tomcat 5 as this user ID TOMCAT5_USER=tomcat55 USER=tomcat55 HOME=/usr/share/tomcat5.5Re: Running OpenOffice 2.x on Ubuntu from Tomcat
There is a step missing above, before you make the directory writable you need to create it:
Re: Install Openoffice headless as a service in Ubuntu