annotate contrib/init.d/d4e-river @ 5777:e95427ed80e5

Merged
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 21 Apr 2013 10:46:59 +0200
parents dc0cc18e7944
children bc4e1bf26227
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.backend.enablejmx=true \
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
32 -Dflys.uesk.keep.artifactsdir=false \
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
33 -Dwsplgen.bin.path=\"$DIR/bin/wsplgen.exe\" \
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
34 -Dwsplgen.log.output=false \
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
35 -Dartifact.database.dir=\"$DIR/conf\""
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
36 MAINCLASS=de.intevation.artifactdatabase.App
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
37
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
38 # For SELinux we need to use 'runuser' not 'su'
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
39 if [ -x "/sbin/runuser" ]; then
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
40 SU="/sbin/runuser"
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
41 else
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
42 SU="/bin/su"
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
43 fi
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
44
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
45 case "$1" in
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
46 start)
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
47 echo "Starting D4E-river server..."
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
48 $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
49 PID=$!
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
50 echo $PID > $PIDFILE
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
51 ;;
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
52 stop)
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
53 echo "Stopping D4E-river server..."
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
54 PID=`cat $PIDFILE`
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
55 STOPRES=0
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
56 while [ $STOPRES -le 0 ]
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
57 do
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
58 kill -15 $PID &> /dev/null
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
59 STOPRES=$?
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
60 sleep 1
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
61 done
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
62 echo "done."
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
63 ;;
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
64 restart)
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
65 $0 stop && $0 start
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 *)
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
68 echo "Usage: $0 [start|stop|restart]"
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
69 esac
dc0cc18e7944 Added SLES start script
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
70

http://dive4elements.wald.intevation.org