Update run.sh
Work in progress
This commit is contained in:
parent
8db3745ae7
commit
f415088e21
26
run.sh
26
run.sh
@ -13,10 +13,11 @@ function setPostgresPassword() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "usage: <import|run>"
|
echo "usage: <import|upgrade|run>"
|
||||||
echo "commands:"
|
echo "commands:"
|
||||||
echo " import: Set up the database and import /data.osm.pbf"
|
echo " import: Set up the database and import /data.osm.pbf"
|
||||||
echo " run: Runs Apache and renderd to serve tiles at /tile/{z}/{x}/{y}.png"
|
écho ". upgrade: Upgrade the database
|
||||||
|
echo " run: Runs Apache and renderd to serve tiles at /tile/{z}/{x}/{y}.png"
|
||||||
echo "environment variables:"
|
echo "environment variables:"
|
||||||
echo " THREADS: defines number of threads used for importing / tile rendering"
|
echo " THREADS: defines number of threads used for importing / tile rendering"
|
||||||
echo " UPDATES: consecutive updates (enabled/disabled)"
|
echo " UPDATES: consecutive updates (enabled/disabled)"
|
||||||
@ -92,6 +93,27 @@ if [ "$1" = "import" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "upgrade" ]; then
|
||||||
|
|
||||||
|
# Ensure that database directory is in right state
|
||||||
|
chown postgres:postgres -R /var/lib/postgresql
|
||||||
|
if [ ! -f /var/lib/postgresql/13/main/PG_VERSION ]; then
|
||||||
|
sudo -u postgres /usr/lib/postgresql/13/bin/pg_ctl -D /var/lib/postgresql/13/main/ initdb -o "--locale C.UTF-8"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize PostgreSQL
|
||||||
|
createPostgresConfig
|
||||||
|
service postgresql start
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
service postgresql stop
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$1" = "run" ]; then
|
if [ "$1" = "run" ]; then
|
||||||
# Clean /tmp
|
# Clean /tmp
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user