Presuming that you want to run an OOo process as a server, here's the command I use to start it for local use by unoconv on Debian Squeeze ($soffice_port is the port it should listen on, commonly 2002):
Code:
soffice -headless -accept="socket,host=127.0.0.1,port=$soffice_port;urp;" -nofirststartwizard &
Here are a couple of bash functions that my be useful (msg is a generalised messaging function).
Code:
#--------------------------
# Name: start_soffice_server
# Purpose: starts an OpenOffice.org server
# Return: 0 if OpenOffice.org server is started; otherwise calls finalise
#--------------------------
function start_soffice_server {
local buf rc
soffice -headless -accept="socket,host=127.0.0.1,port=$soffice_port;urp;" -nofirststartwizard &
disown $! # Suppresses the bash job control job ending message
for (( i=0; i<wait_for_soffice_server; i++ ))
do
sleep 1
ck_soffice_server && return 0
done
msg E "Timed out waiting for $wait_for_soffice_server seconds for OpenOffice.org server to start"
finalise 1
} # end of function start_soffice_server
#--------------------------
# Name: ck_soffice_server
# Purpose: checks whether a OpenOffice.org server is running
# Return: 0 if one is running; 1 if not
#--------------------------
function ck_soffice_server {
local buf
# Is a soffice.bin process listening on the port?
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
buf=$( netstat --all --numeric --program --tcp 2>/dev/null | grep ":$soffice_port .*LISTEN" )
if [[ $buf =~ /soffice.bin$ ]]; then
return 0
else
return 1
fi
} # end of function ck_soffice_server
Regards the boot script, I no longer have access to a CentOS system but do have a log for a CentOS 5.5 system which records creating boot scripts in /etc/rc.d/init.d/ with 544 permissions and using chkconfig to install links to them in appropriate directories.