-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathoffice_xvfb
64 lines (61 loc) · 1.47 KB
/
office_xvfb
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/sh
### BEGIN INIT INFO
# Provides: ooo-xvfb
# Required-Start: $network $xvfb
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop ooo-xvfb
# Description: OpenOffice Headless Mode Server
# Author: Normunds Vilcans, Alistek SIA
#
### END INIT INFO
#OOo_HOME=/usr/bin
#SOFFICE_PATH=$OOo_HOME/soffice
OOo_HOME=/usr/lib/libreoffice/program
SOFFICE_PATH=$OOo_HOME/soffice.bin
PIDFILE=/var/run/openoffice-server.pid
VDISPLAY='89' #should be the same as in xvfb init script
ADDRESS=localhost #can change to IP adress
case "$1" in
start)
if [ -f $PIDFILE ]; then
echo "OpenOffice headless server has already started."
sleep 2
exit
fi
echo "Starting OpenOffice headless server"
$SOFFICE_PATH --nologo --nofirststartwizard --accept="socket,host=$ADDRESS,port=8100;urp" --display $VDISPLAY & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo "Stopping OpenOffice headless server."
killall -9 soffice ; killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo "Openoffice headless server is not running."
exit
;;
restart)
echo "Restarting " $0
killall -9 soffice ; killall -9 soffice.bin
sleep 3
$0 stop
$0 start
;;
status)
CHECKPID=`pidof soffice.bin`
if [ "$CHECKPID" ]; then
echo "OpenOffice Headless Server is Up (pid:$CHECKPID)"
else
echo "OpenOffice Headless Server is not running"
fi
exit
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0