libreoffice-headless
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# libreoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless libreoffice server script
# processname: libreoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
# Modified by Manuel Vega Ulloa
OOo_HOME=/usr/bin
SOFFICE_PATH=$OOo_HOME/soffice
PIDFILE=/var/run/libreoffice-server.pid
set -e
case "$1" in
start)
if [ -f $PIDFILE ]; then
echo "LibreOffice headless server has already started."
sleep 5
exit
fi
echo "Starting LibreOffice headless server"
$SOFFICE_PATH --headless --nologo --nofirststartwizard --accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
PID=`ps ax | grep "soffice.bin --headless"| grep -v grep|cut -d \ -f 1`
echo $PID> $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo "Stopping LibreOffice headless server."
kill `cat $PIDFILE`
rm -f $PIDFILE
exit
fi
echo "LibreOffice headless server is not running."
exit
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0