fix(scripts): remove disk info file on uninstall

This commit is contained in:
Jake Turner 2026-01-13 08:02:36 -08:00
parent ae46e276fb
commit 4bb5dd6a18
No known key found for this signature in database
GPG Key ID: 694BC38EF2ED4844

View File

@ -18,6 +18,7 @@
NOMAD_DIR="/opt/project-nomad" NOMAD_DIR="/opt/project-nomad"
MANAGEMENT_COMPOSE_FILE="${NOMAD_DIR}/compose.yml" MANAGEMENT_COMPOSE_FILE="${NOMAD_DIR}/compose.yml"
COLLECT_DISK_INFO_PID="/var/run/nomad-collect-disk-info.pid" COLLECT_DISK_INFO_PID="/var/run/nomad-collect-disk-info.pid"
DISK_INFO_FILE="/tmp/nomad-disk-info.json"
################################################################################################################################################################################################### ###################################################################################################################################################################################################
# # # #
@ -86,6 +87,14 @@ try_remove_disk_info_script() {
fi fi
} }
try_remove_disk_info_file() {
if [ -f "$DISK_INFO_FILE" ]; then
echo "Removing disk info file..."
rm -f "$DISK_INFO_FILE"
echo "Disk info file removed."
fi
}
uninstall_nomad() { uninstall_nomad() {
echo "Stopping and removing Project N.O.M.A.D. management containers..." echo "Stopping and removing Project N.O.M.A.D. management containers..."
docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down
@ -104,6 +113,9 @@ uninstall_nomad() {
# Try to stop the collect-disk-info script if it's running # Try to stop the collect-disk-info script if it's running
try_remove_disk_info_script try_remove_disk_info_script
# Try to remove the disk info file if it exists
try_remove_disk_info_file
echo "Removing Project N.O.M.A.D. files..." echo "Removing Project N.O.M.A.D. files..."
rm -rf "${NOMAD_DIR}" rm -rf "${NOMAD_DIR}"