---
title: "openoffice linux 服务安装"
author: "香格里拉没有底"
date: "2017-01-10T14:52:35Z"
tags: []
categories: ["操作系统"]
slug: "openoffice-linux"
draft: false
lastmod: "2017-01-10T14:54:09Z"
id: 2352242
url: "https://onekeyes.iteye.com/blog/2352242"
---

1\. 启动脚本编写（cd /etc/Init.d）

 

```
#!/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  
```

 2.命令授权

 

   

```
chmod 755 soffice  
```

 

 3.命令启动

 

```
service soffice start/stop/restart  
```

 

参考自：http://blog.sina.com.cn/s/blog\_6c969b4a0102vmsn.html