comparison contrib/init.d/d4e-river @ 5118:dc0cc18e7944

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

http://dive4elements.wald.intevation.org