解决openoffice进程异常退出的办法
步骤1 编写脚本
openoffice.sh
#!/usr/bin/bash
OPENOFFICEPID=`ps -ef|grep "/opt/openoffice4/program/soffice"|grep -v grep|grep -v grep|awk '{print $2}'`
if [ ! -n "$OPENOFFICEPID" ];then
echo "OPENOFFICEPID is empty"
echo "start openoffice"
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.Service" -nofirststartwizard &
else
echo "OPENOFFICEPID is $OPENOFFICEPID is started!"
fi
步骤2 将openoffice.sh脚本放置在root目录下面,如图所示:
步骤3 赋权限
[root@localhost ~]#chmod a+x openoffice.sh
步骤4 编辑crontab文件
[root@localhost ~]# cd /var/spool/cron
[root@localhost cron]# crontab -e
编辑内容如下
* * * * * /root/openoffice.sh
注:每1分钟执行一次此脚本,可以根据实际需要进行
步骤5 验证:
查看当前的启动的openOffice
[root@localhost cron]# ps -ef|grep /opt/openoffice4/program/soffice
删除后
--将openoffice所有进程杀掉
ps -ef|grep "/opt/openoffice4/program/soffice"|grep -v grep|grep -v grep|awk '{print $2}' | xargs kill
等一分钟后查看(通过对比时间)