root/tools/routingservice/branches/wrs-2.0/wrs-2.0.sh

Revision 343, 2.4 KB (checked in by anton, 14 months ago)

json.jar added

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3#
4# A simple startup script
5#
6SCRIPT=$(readlink -f $0)
7cd `dirname $SCRIPT`
8
9# Run this program
10PROGRAM="java -cp bin/:\
11lib/commons-collections-3.2.1.jar:\
12lib/org.restlet.jar:\
13lib/antlr-2.7.7.jar:\
14lib/stringtemplate.jar:\
15lib/postgresql-8.3-604.jdbc4.jar:\
16lib/gt-referencing-2.5.2.jar:\
17lib/geoapi-2.2-M1.jar:\
18lib/gt-metadata-2.5.2.jar:\
19lib/gt-epsg-extension-2.5.2.jar:\
20lib/gt-epsg-wkt-2.5.2.jar:\
21lib/jsr-275-1.0-beta-2.jar:\
22lib/vecmath-1.3.1.jar:\
23lib/acme.jar:\
24lib/flexjson.jar:\
25lib/json.jar:\
26lib/jdom.jar:\
27lib/jts-1.10.jar:\
28lib/xerces.jar:\
29lib/gt-api-2.5.2.jar:\
30lib/\
31 WRS ./data/configuration.xml"
32
33# In case "identifier" parameter is not set
34if [ $2 ]
35then
36        pidfile="logs/restlet-$2-2.0.pid"
37else
38        pidfile="logs/restlet-wrs-2.0.pid"
39fi
40
41# What should the service do?
42case $1 in
43        start)
44
45echo "
46Service starting ..."
47
48                if [ -e "$pidfile" ]
49                then
50
51echo "Service is already running!"
52echo "Do nothing ...
53[$pidfile]
54
55"
56                else
57                        $PROGRAM &
58                        PID=$!
59                        echo $PID > "$pidfile"
60
61echo "Service started!
62[$pidfile|$PID]
63
64"
65                fi             
66        ;;
67       
68        restart)
69
70echo "
71Service restarting ..."
72
73                if [ -e "$pidfile" ]
74                then
75                        pid2kill=`cat $pidfile`
76                        kill -9 $pid2kill
77                        rm $pidfile
78
79echo "Service stopped!"
80
81                else
82
83echo "No running service found ... starting a new one!"
84
85                fi
86               
87                $PROGRAM &
88                PID=$!
89                echo $PID > "$pidfile"
90
91echo "Service started!
92[$pidfile|$PID]
93
94"
95        ;;
96       
97        stop)
98                if [ -e "$pidfile" ]
99                then
100                        pid2kill=`cat $pidfile`
101                        kill -9 $pid2kill
102                        rm $pidfile
103
104echo "
105Service stopped!
106[$pid2kill]
107
108"
109                else
110echo "
111No service found!
112
113"
114                fi
115        ;;
116
117
118        list)
119                # get current processes
120echo "
121Currently active WRS process(es):
122"
123
124ps afx | grep restlet
125
126echo "
127
128"
129        ;;
130       
131        debug)
132                # run the program as is
133echo "
134Service starting in DEBUG mode ...
135Type CTRL-C to stop the service.
136
137"
138                $PROGRAM
139        ;;
140       
141        help)
142echo "
143This is the Webrouting Service startup script
144
145Usage:
146        ./wrs-2.0.sh {start|stop|restart|debug|list|help} [identifier]
147
148Commands:
149        start           Start the service
150        stop            Stop the service
151        restart         Stop and immediately start the service again
152        debug           Run the service in debug mode
153                        This will print log messages to the terminal window.
154        list            List currently active process(es)
155        help            Show the startup help
156
157Optional:
158        identifier      Run the service as a distinct process.
159
160"
161        ;;
162       
163        *)
164echo "
165Usage: ./wrs-2.0.sh {start|stop|restart|debug|help}
166
167"
168        ;;
169esac
Note: See TracBrowser for help on using the browser.