mbtileserver - Added initial systemd user-level service for the raster tile server

This commit is contained in:
thetechprepper
2025-07-05 17:26:23 -07:00
parent 4ae0741aeb
commit 0972c58c4c
4 changed files with 61 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 5 July 2025
# Purpose : Wrapper script for starting the raster tile server
#
# Preconditions:
# 1. At least one .mbtiles files exist in the tileset directory
#
# Postconditions:
# 1. mbtileserver is started
# 2. Tile server available at http://localhost:8000/services
TILESERVER_HOME="${HOME}/.local/share/emcomm-tools/mbtileserver"
TILESERVER_TILE_DIR="${TILESERVER_HOME}/tilesets"
start() {
CWD_DIR=$(pwd)
cd ${TILESERVER_HOME}
CMD="mbtileserver"
et-log "Starting raster tile server in ${TILESERVER_HOME} with: ${CMD}"
${CMD}
cd ${CWD_DIR}
}
if [[ ! -e ${TILESERVER_TILE_DIR} ]]; then
et-log "Tile set directory does not exist: ${TILESERVER_TILE_DIR}."
exit 1
fi
ls ${TILESERVER_TILE_DIR}/*.mbtiles
if [[ $? -ne 0 ]]; then
et-log "Can't start tile server. No .mbtiles in ${TILESERVER_TILE_DIR}"
exit 1
fi
start