forked from mediasuitenz/docker-overpass-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overpass
executable file
·66 lines (55 loc) · 1.67 KB
/
overpass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
### BEGIN INIT INFO
# Provides: overpass
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Overpass API dispatcher daemon
### END INIT INFO
DB_DIR=/srv/osm3s/db
EXEC_DIR=/srv/osm3s
LOG_DIR=/var/log/overpass
RUN_AS_USER=root
mkdir $LOG_DIR 2>/dev/null
DISPATCHER_PID_FILE=/var/run/dispatcher.pid
DISPATCHER_OPTIONS="--osm-base --db-dir=$DB_DIR"
DISPATCHER=$EXEC_DIR/bin/dispatcher
test -x $DISPATCHER || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Overpass dispatcher daemon" "dispatcher"
if test -f $DISPATCHER_PID_FILE; then
echo "dispatcher already running?"
exit 1
fi
rm $DB_DIR/osm3s* 2>/dev/null
rm /dev/shm/osm3s* 2>/dev/null
if start-stop-daemon --start --quiet -b --oknodo --make-pidfile -c $RUN_AS_USER --pidfile $DISPATCHER_PID_FILE --exec $DISPATCHER -- $DISPATCHER_OPTIONS >> $LOG_DIR/dispatcher.log 2>&1; then
mkdir /tmp/translate_xapi 2>/dev/null
chmod 777 /tmp/translate_xapi
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping Overpass dispatcher daemon" "dispatcher"
if start-stop-daemon --stop --quiet --oknodo --pidfile $DISPATCHER_PID_FILE; then
log_end_msg 0
rm $DB_DIR/osm3s* 2>/dev/null
rm /dev/shm/osm3s* 2>/dev/null
rm -f $DISPATCHER_PID_FILE
else
log_end_msg 1
fi
;;
status)
status_of_proc -p $DISPATCHER_PID_FILE "" "overpass dispatcher"
;;
*)
log_action_msg "Usage: /etc/init.d/overpass {start|stop|status}"
exit 1
esac
exit 0