Mercurial > dive4elements > river
annotate contrib/init.d/d4e-river @ 6724:0baf7abffcc6
issue1393/ImportRiver: Import official epochs from directory, minor refac.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 31 Jul 2013 11:13:41 +0200 |
parents | bc4e1bf26227 |
children | 1709c429818a |
rev | line source |
---|---|
5118
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 # |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 ### BEGIN INIT INFO |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 # Provides: d4e-server |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 # Required-Start: $network $syslog $remote_fs |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 # Should-Start: $named $syslog $time |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 # Required-Stop: $network $syslog |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 # Should-Stop: $named $syslog $time |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 # Default-Start: 3 5 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 # Default-Stop: 0 1 2 6 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 # Short-Description: Dive4Elements server |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 # Description: Start Dive4Elements server |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 ### END INIT INFO |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 RUNAS=flys |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 DIR="/opt/flys/current/server" |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 CLASSPATH= |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 for l in `find "$DIR/bin/lib" -name \*.jar -print`; do |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 CLASSPATH=$CLASSPATH:$l |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 done |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 LOGFILE=/var/log/d4e-river.log |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 PIDFILE=/var/run/d4e-river.pid |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 ARGS="-Xmx256m \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 -server \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 -Djava.awt.headless=true \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 -Dflys.datacage.recommendations.development=false \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 -Djava.io.tmpdir=\"$DIR/cache\" \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 -Dflys.uesk.keep.artifactsdir=false \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 -Dwsplgen.bin.path=\"$DIR/bin/wsplgen.exe\" \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
33 -Dwsplgen.log.output=false \ |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
34 -Dartifact.database.dir=\"$DIR/conf\"" |
5872
bc4e1bf26227
init.d: Adjusted startup script.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5118
diff
changeset
|
35 MAINCLASS=org.dive4elements.artifactdatabase.App |
5118
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
36 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 # For SELinux we need to use 'runuser' not 'su' |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
38 if [ -x "/sbin/runuser" ]; then |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 SU="/sbin/runuser" |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
40 else |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
41 SU="/bin/su" |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 fi |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
44 case "$1" in |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 start) |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 echo "Starting D4E-river server..." |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 $SU - $RUNAS -c "/usr/bin/java -classpath $CLASSPATH $ARGS $MAINCLASS" &> $LOGFILE & |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 PID=$! |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 echo $PID > $PIDFILE |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 ;; |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 stop) |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 echo "Stopping D4E-river server..." |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 PID=`cat $PIDFILE` |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 STOPRES=0 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 while [ $STOPRES -le 0 ] |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 do |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 kill -15 $PID &> /dev/null |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 STOPRES=$? |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
59 sleep 1 |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
60 done |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 echo "done." |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 ;; |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 restart) |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 $0 stop && $0 start |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 ;; |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 *) |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 echo "Usage: $0 [start|stop|restart]" |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 esac |
dc0cc18e7944
Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
69 |