fixing hamclock

This commit is contained in:
David Young
2026-04-30 11:46:41 -06:00
parent 864f97b473
commit aa42540acc
4 changed files with 38 additions and 14 deletions

33
scripts/hamclock-cleanup.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
#
# Purpose : Migrate hamclock to updated working directory and restart the service.
# ESPHamClock web server stores config in its working directory; this
# moves those files from the old location (~/.local/bin/) to the new
# dedicated data dir (~/.local/share/hamclock/).
OLD_DIR="$HOME/.local/bin"
NEW_DIR="$HOME/.local/share/hamclock"
# ESPHamClock data files written to the working directory
HAMCLOCK_DATA_FILES=(
"hamclock.txt"
".hamclock"
)
echo "Stopping hamclock service..."
systemctl --user stop hamclock 2>/dev/null || true
mkdir -p "$NEW_DIR"
for f in "${HAMCLOCK_DATA_FILES[@]}"; do
if [ -f "$OLD_DIR/$f" ]; then
echo "Migrating $f to $NEW_DIR/"
mv "$OLD_DIR/$f" "$NEW_DIR/$f"
fi
done
echo "Reloading hamclock service..."
systemctl --user daemon-reload
systemctl --user restart hamclock
echo "hamclock cleanup done."

View File

@@ -1,11 +0,0 @@
#!/bin/sh
# Start HamClock
HAMCLOCK="$HOME/.local/bin/hamclock"
if [ ! -x "$HAMCLOCK" ]; then
echo "Error: hamclock not found or not executable at $HAMCLOCK" >&2
exit 1
fi
"$HAMCLOCK" "$@" &