Set the same cache algorithms as rails is using.
[gpx-import.git] / settings.sh
1 #!/bin/sh
2
3 # This script configures the environment to use the OSM db
4 # so that the gpx-import program can find it.
5
6 setting () {
7   S_N=GPX_$1
8   shift
9   eval "${S_N}='$*'"
10   export ${S_N}
11 }
12
13 # General settings
14 setting SLEEP_TIME 1
15
16 # Paths (can be relative from invocation path if appropriate)
17 setting PATH_TRACES /home/osm/traces
18 setting PATH_IMAGES /home/osm/images
19 setting PATH_TEMPLATES templates/
20
21 # PostgreSQL connection
22 setting PGSQL_HOST localhost
23 #setting PGSQL_USER openstreetmap
24 setting PGSQL_DB openstreetmap
25 #setting PGSQL_PASS openstreetmap
26
27 # MySQL connection
28 #setting MYSQL_HOST localhost
29 #setting MYSQL_USER openstreetmap
30 #setting MYSQL_DB openstreetmap
31 #setting MYSQL_PASS openstreetmap
32
33 # Memcache caches
34 #setting MEMCACHE_SERVERS localhost
35
36 # Logging, pidfiles etc
37 # If you comment out the LOGFILE then it will log to stdout
38 setting LOG_FILE /home/osm/gpx-import.log
39 # If you comment out the PIDFILE then it will not daemonise
40 setting PID_FILE /home/osm/gpx-import.pid
41
42 # Mail notifications
43 #setting MAIL_SENDER example@example.com
44
45 # Optional debug statements
46 #setting INTERPOLATE_STDOUT 1
47
48 CMD=$1
49 shift
50
51 case "$CMD" in
52     start)
53         if test "x$GPX_PID_FILE" = "x"; then
54             exec "$@"
55         else
56             "$@"
57             $0 check
58         fi
59         ;;
60     stop)
61         if test -r $GPX_PID_FILE; then
62             PID=$(cat $GPX_PID_FILE)
63             if test "x$PID" != "x"; then
64                 if kill -0 $PID; then
65                     kill -TERM $PID
66                     for TRY in $(seq 1 10); do
67                         sleep 1
68                         if ! kill -0 $PID; then
69                             echo "GPX daemon killed"
70                             rm -f $GPX_PID_FILE
71                             exit 0
72                         else
73                             echo "Still running?"
74                         fi
75                     done
76                     echo "GPX daemon still running?"
77                     exit 1
78                 else
79                     echo "GPX daemon is not running, pid ?= $PID"
80                     exit 1
81                 fi
82             else
83                 echo "GPX daemon pidfile is empty"
84                 exit 1
85             fi
86         else
87             echo "GPX daemon pidfile is missing"
88             exit 1
89         fi
90         ;;
91     rotated)
92         if test -r $GPX_PID_FILE; then
93             PID=$(cat $GPX_PID_FILE)
94             if test "x$PID" != "x"; then
95                 if kill -0 $PID; then
96                     kill -HUP $PID
97                     echo "GPX daemon sent HUP"
98                     sleep 0.5
99                     $0 check
100                 else
101                     echo "GPX daemon is not running, pid ?= $PID"
102                 fi
103             else
104                 echo "GPX daemon pidfile is empty"
105             fi
106         else
107             echo "GPX daemon pidfile is missing"
108         fi
109         ;;
110     check)
111         if test -r $GPX_PID_FILE; then
112             PID=$(cat $GPX_PID_FILE)
113             if test "x$PID" != "x"; then
114                 if kill -0 $PID; then
115                     echo "GPX daemon is running, pid = $PID"
116                 else
117                     echo "GPX daemon is not running, pid ?= $PID"
118                     exit 1
119                 fi
120             else
121                 echo "GPX daemon pidfile is empty"
122                 exit 1
123             fi
124         else
125             echo "GPX daemon pidfile is missing"
126             exit 1
127         fi
128         ;;
129     *)
130         echo "usage: $0 [start|stop|rotated|check] path/to/gpx-import"
131         ;;
132 esac