1、启动脚本:
  cd /etc/Init.d
  vi soffice
  2、编写脚本

 

#!/bin/bash
# Boot open office so that Alfresco can do transforms.
# chkconfig: 2345 55 25
# description: OpenOffice Headless
#
# processname: soffice
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
VDISPLAY='99'
SOFFICE_PATH='/opt/openoffice4/program/'
SOFFICE_ARGS1="-nofirststartwizard -nologo -headless -display :$VDISPLAY "
SOFFICE_ARGS2='-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager'
SOFFICE_PIDFILE=/var/run/soffice.pid
start_soffice() {
echo -n $"Starting OpenOffice"
$SOFFICE_PATH/soffice $SOFFICE_ARGS1 $SOFFICE_ARGS2 >/dev/null 2>&1 &
[ $? -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

  3、授权:
  chmod 755 soffice
  4、开启关闭:
  service soffice start/stop/restart