Stopping/starting renderd during map import. Moving tile cache clearing to import script.

This commit is contained in:
Roland 2023-08-17 11:47:34 -06:00
parent 6376e6539b
commit 6791e88baf
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
8 changed files with 26 additions and 49 deletions

View file

@ -24,15 +24,24 @@ if [ ${HAS_ICE_SHEET} = false ]; then
exit 4
fi
# Re-execute this script if it wasn't called with sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
function cleanup() {
if [ -f ${MERGED_TMP_FILE} ]; then
rm ${MERGED_TMP_FILE}
fi
systemctl restart renderd
}
trap cleanup EXIT
cleanup
systemctl stop renderd
if [[ ${1} == *.osm.pbf ]]; then
# Import PBF files.
for i in "$@"; do
@ -93,3 +102,7 @@ else
echo "WROLPi: Cannot import unknown map file"
exit 8
fi
# Clear map tile cache only after successful import.
[ -d /var/lib/mod_tile/ajt ] && rm -rf /var/lib/mod_tile/ajt
[ -d /var/cache/renderd/tiles/ajt ] && rm -rf /var/cache/renderd/tiles/ajt