mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
mbtileserver - Added initial systemd user-level service for the raster tile server
This commit is contained in:
+1
@@ -0,0 +1 @@
|
|||||||
|
../et-service-mbtileserver.service
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Author : Gaston Gonzalez
|
||||||
|
# Date : 5 July 2025
|
||||||
|
# Purpose : User systemd unit file for EmComm Tools raster tile service
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# Check status : systemctl --user status et-service-mbtileservice
|
||||||
|
# Start service : systemctl --user start et-service-mbtileservice
|
||||||
|
# Stop service : systemctl --user stop et-service-mbtileservice
|
||||||
|
# Reload this config : systemctl --user daemon-reload
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=EmComm Tools raster tile service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/opt/emcomm-tools/bin/et-mbtileserver
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Copy your `.mbtiles` file here.
|
||||||
Executable
+40
@@ -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
|
||||||
Reference in New Issue
Block a user