]> git.openstreetmap.org Git - chef.git/blob - cookbooks/web/templates/default/cgimap.init.erb
888e10cff321d1d29cd23163698fa68cb3488d14
[chef.git] / cookbooks / web / templates / default / cgimap.init.erb
1 #!/bin/bash
2
3 CGIMAP_HOST=<%= @database_host %>; export CGIMAP_HOST
4 CGIMAP_DBNAME=openstreetmap; export CGIMAP_DBNAME
5 CGIMAP_USERNAME=rails; export CGIMAP_USERNAME
6 CGIMAP_PASSWORD=<%= @db_password %>; export CGIMAP_PASSWORD
7
8 CGIMAP_PIDFILE=<%= @pid_directory + "/cgimap.pid" %>; export CGIMAP_PIDFILE
9 CGIMAP_LOGFILE=<%= @log_directory + "/cgimap.log" %>; export CGIMAP_LOGFILE
10
11 CGIMAP_MEMCACHE=<%= @memcached_servers.join(",") %>; export CGIMAP_MEMCACHE
12 CGIMAP_RATELIMIT=204800; export CGIMAP_RATELIMIT
13 CGIMAP_MAXDEBT=250; export CGIMAP_MAXDEBT
14
15 start() {
16   start-stop-daemon --start --chuid rails --exec /usr/bin/openstreetmap-cgimap -- --daemon --port=8000 --instances=30 --pidfile $CGIMAP_PIDFILE
17 }
18
19 stop() {
20   start-stop-daemon --stop --retry 300 --pidfile $CGIMAP_PIDFILE
21 }
22
23 reload() {
24   start-stop-daemon --stop --signal HUP --pidfile $CGIMAP_PIDFILE
25 }
26
27 case "$1" in
28   start)
29     start
30     ;;
31   stop)
32     stop
33     ;;
34   reload)
35     reload
36     ;;
37   restart)
38     stop || exit $?
39     start
40     ;;
41 esac