[SOLVED] Start OpenOffice at boot-time headless

Issues related to software problems.
Post Reply
tombed
Posts: 5
Joined: 2010/11/10 09:20:44

[SOLVED] Start OpenOffice at boot-time headless

Post by tombed » 2010/12/06 13:31:39

I try to start openoffice in server mode so a CMS can use it to convert documents.

In a shell I can call

/usr/lib/openoffice.org3/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard -display:1 &

and it starts successfully and the CMS can use it.

To start OO at boot time, I wrote a script called 'openofficeserver' and saved it to /etc/init.d. It looks as follows

------------
. /etc/rc.d/init.d/functions

RETVAL=0
SOFFICE_PATH='/usr/lib/openoffice.org3/program'
SOFFICE_ARGS='-headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard -display:1'
SOFFICE_PIDFILE=/var/run/soffice.bin.pid

start_soffice() {
echo -n $"Starting OpenOffice.org with command $SOFFICE_PATH/soffice $SOFFICE_ARGS &"
daemon $SOFFICE_PATH/soffice $SOFFICE_ARGS &
[ $? -eq 0 ] && echo_success || echo_failure
pidof soffice > $SOFFICE_PIDFILE
echo
}
start() {
start_soffice
}
stop() {
echo -n $"Stopping OpenOffice"
killproc soffice
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
esac
-------------

If I start now with

[b]service openofficeserver start[/b]

I get the following error:

Starting OpenOffice.org with command /usr/lib/openoffice.org3/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard -display:1 & [ OK ]
[root@liferay init.d]# /usr/lib/openoffice.org3/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)


Does anybody know, what the problem with the X-Window system could be? Looks like a permission problem but I don't know anything about X and how to configure it.

Any help would be greatly appreciated.

Tom

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Start OpenOffice at boot-time headless

Post by pschaff » 2010/12/06 15:37:07

I have not run OOo headless, but it seems that there should be no display specified. The display should be opened on the remote client, not the server. My guess is that the problem is due to the "-display:1" parameter.

teleport
Posts: 114
Joined: 2005/09/09 05:30:18
Contact:

[SOLVED] Start OpenOffice at boot-time headless

Post by teleport » 2010/12/07 10:06:31

I use following script to run openoffice at boot time:

If You are running 32bit Centos, then fix SOFFICE_PATH.

# cat /etc/init.d/soffice

[code]#!/bin/bash
# chkconfig: 345 20 80
# description: init.d script for headless openoffice.org (2.3+ for RHEL5 64bit)
#
# processname: soffice
#
# source function library
. /etc/rc.d/init.d/functions

RETVAL=0
SOFFICE_PATH='/usr/lib64/openoffice.org3/program'
SOFFICE_ARGS='-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager -headless -nofirststartwizard -nologo'
SOFFICE_PIDFILE=/var/run/soffice.bin.pid

start_soffice() {
echo -n $"Starting OpenOffice.org"
$SOFFICE_PATH/soffice.bin $SOFFICE_ARGS >/dev/null 2>&1 &
[ $? -eq 0 ] && echo_success || echo_failure
pidof soffice.bin > $SOFFICE_PIDFILE
echo
}
start() {
start_soffice
}
stop() {
echo -n $"Stopping OpenOffice"
killproc soffice
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
esac
[/code]

tombed
Posts: 5
Joined: 2010/11/10 09:20:44

Re: Start OpenOffice at boot-time headless

Post by tombed » 2010/12/20 19:33:07

Thanks to all for your inputs. Unfortunately none changed anything! I still got the same error!

[root@liferay program]# service openofficeserver start
Starting OpenOffice.org with command /usr/lib/openoffice.org3/program/soffice.bin -accept=socket,host=localhost,port=8100;urp;OpenOffice.ServiceManager -headless -nofirststartwizard -nologo &/usr/lib/openoffice.org3/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)
[ OK ]

By searching the web I found a WIKI entry at alfresco saying that there [i]needs to be installed a package[/i] called [b]openoffice.org-headless[/b]. This installes a OOO plugin which is required to make the -headless commandline option work! After installing this package the X11 error message is gone!

So for all on CentOS you need to run:

[i][b]yum install openoffice.org-headless[/b][/i]

Problem solved, hope it may help others too!!

Thanks again for your inputs!

Tom

User avatar
AlanBartlett
Forum Moderator
Posts: 9336
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [SOLVED] Start OpenOffice at boot-time headless

Post by AlanBartlett » 2010/12/20 22:56:43

Thank you for reporting back with the eventual solution.

For posterity, this thread is now marked [SOLVED].

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: [SOLVED] Start OpenOffice at boot-time headless

Post by pschaff » 2010/12/21 13:59:35

[quote]
tombed wrote:
...
So for all on CentOS you need to run:

[i][b]yum install openoffice.org-headless[/b][/i]

Problem solved, hope it may help others too!!
[/quote]
[Imagine emoticon for "head slap"!] It never occurred to me that you would not have installed that if trying to run headless. Thanks for reporting back. Future forum searchers will certainly appreciated it.

Post Reply

Return to “CentOS 5 - Software Support”