View File | Revision Log | Show Annotations | Download File | View Changeset
/hippo/file-import-service/trunk/fileimport-scripts/ooo-start.sh
Revision: 8908
Committed: Tue Nov 13 11:35:12 2007 UTC (14 years, 7 months ago) by boudekerk
Content type: application/x-sh
File size: 2688 byte(s)
Log Message:
FIS-2: Added -nofirststartwizard

File Contents

# Content
1 #!/bin/bash
2 #
3 #
4 # BvdS [schans@hippo.nl]
5
6 CONFFILE="fileimport.conf"
7
8 # Resolve the location of the 'ps' command
9 getps() {
10 PSEXE="/usr/bin/ps"
11 if [ ! -x $PSEXE ]
12 then
13 PSEXE="/bin/ps"
14 if [ ! -x $PSEXE ]
15 then
16 echo "Unable to locate 'ps'."
17 echo "Please report this with the location on your system."
18 exit 1
19 fi
20 fi
21 }
22
23 # Get pid from pidfile
24 getpid() {
25 unset pid
26 if [ -f $PIDFILE ]
27 then
28 if [ -r $PIDFILE ]
29 then
30 pid=`cat $PIDFILE`
31 if [ "X$pid" != "X" ]
32 then
33 getps
34 # Verify that a process with this pid is still running.
35 pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
36 if [ "X$pid" = "X" ]
37 then
38 # This is a stale pid file.
39 rm -f $PIDFILE
40 echo "Removed stale pid file: $PIDFILE"
41 fi
42 fi
43 else
44 echo "Cannot read $PIDFILE."
45 exit 1
46 fi
47 fi
48 }
49
50 # Check that config exists.
51 if [ ! -f ${CONFFILE} ]; then
52 cd $OLDDIR
53 echo "Config file ${CONFFILE} not found."
54 exit 0
55 fi
56
57 # source config
58 . ${CONFFILE}
59
60 PIDFILE="xvnc.pid"
61 getpid
62 if [ "X$pid" = "X" ]; then
63 echo -n "Attempting to start Xvnc..."
64 #echo " - ${XVNC} :${DISNUM} &"
65
66 ${XVNC} :${DISNUM} >> ./xvnc.log 2>&1 &
67
68 echo $! > $PIDFILE
69 sleep 1
70
71 # Check if running
72 getps
73 pid=`cat $PIDFILE`
74 pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
75 if [ "X$pid" = "X" ]; then
76 echo "failed."
77 exit 1
78 else
79 echo "started."
80 fi
81 else
82 echo "Xvnc is already running."
83 fi
84
85
86
87 PIDFILE="ooo.pid"
88 getpid
89 if [ "X$pid" = "X" ]; then
90 echo -n "Attempting to start OpenOffice..."
91 #echo " - ${OOODIR}/program/soffice.bin \"-accept=socket,host=127.0.0.1,port=${PORT};urp;\" -invisible -server -headless -nologo -nofirststartwizard -display :${DISNUM} &"
92 ${OOODIR}/program/soffice.bin "-accept=socket,host=127.0.0.1,port=${PORT};urp;" -invisible -server -headless -nologo -nofirststartwizard -display :${DISNUM} >> ./ooo.log 2>&1 &
93 echo $! > $PIDFILE
94 sleep 1
95
96 # Check if running
97 getps
98 pid=`cat $PIDFILE`
99 pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
100 if [ "X$pid" = "X" ]; then
101 echo "failed."
102 exit 1
103 else
104 echo "started."
105 fi
106 else
107 echo "OpenOffice is already running."
108 fi
109
110 exit 0