#!/bin/bash CGIMAP_HOST=<%= @database_host %>; export CGIMAP_HOST CGIMAP_DBNAME=openstreetmap; export CGIMAP_DBNAME CGIMAP_USERNAME=rails; export CGIMAP_USERNAME CGIMAP_PASSWORD=<%= @db_password %>; export CGIMAP_PASSWORD CGIMAP_PIDFILE=<%= @pid_directory + "/cgimap.pid" %>; export CGIMAP_PIDFILE CGIMAP_LOGFILE=<%= @log_directory + "/cgimap.log" %>; export CGIMAP_LOGFILE CGIMAP_MEMCACHE=<%= @memcached_servers.join(",") %>; export CGIMAP_MEMCACHE CGIMAP_RATELIMIT=204800; export CGIMAP_RATELIMIT CGIMAP_MAXDEBT=250; export CGIMAP_MAXDEBT start() { start-stop-daemon --start --chuid rails --exec /usr/bin/openstreetmap-cgimap --pidfile $CGIMAP_PIDFILE -- --daemon <% if @database_readonly %>--readonly<% end %> --port=8000 --instances=30 } stop() { start-stop-daemon --stop --retry 300 --pidfile $CGIMAP_PIDFILE } reload() { start-stop-daemon --stop --signal HUP --pidfile $CGIMAP_PIDFILE } case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop || exit $? start ;; esac