From 02c1d70afe88f1848ce4a588e83f868a1d40adea Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 13 Apr 2026 15:50:47 -0600 Subject: [PATCH] Service files --- install-openhamclock.sh | 6 ++++++ install.sh | 23 ++++++----------------- packages.conf | 5 +---- servicefiles/hamclock.service | 13 +++++++++++++ servicefiles/openhamclock.service | 13 +++++++++++++ 5 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 servicefiles/hamclock.service create mode 100644 servicefiles/openhamclock.service diff --git a/install-openhamclock.sh b/install-openhamclock.sh index 2eb8a32..4837bd8 100755 --- a/install-openhamclock.sh +++ b/install-openhamclock.sh @@ -10,4 +10,10 @@ fi cd "$HOME/.local/bin/openhamclock" && npm install +mkdir -p "$HOME/.config/systemd/user" +cp "$HOME/.local/share/HamPackServer/servicefiles/openhamclock.service" "$HOME/.config/systemd/user/" + +systemctl --user daemon-reload +systemctl --user enable --now openhamclock + echo "openhamclock is installed"... \ No newline at end of file diff --git a/install.sh b/install.sh index 7b61a30..62289e1 100755 --- a/install.sh +++ b/install.sh @@ -70,6 +70,11 @@ cp "$HOME/.local/share/HamPackServer/hampackserverupdate" "$HOME/.local/bin/hamp cp "$HOME/.local/share/HamPackServer/scripts/start-hamclock.sh" "$HOME/.local/bin/start-hamclock.sh" chmod +x "$HOME/.local/bin/start-hamclock.sh" +mkdir -p "$HOME/.config/systemd/user" +cp "$HOME/.local/share/HamPackServer/servicefiles/hamclock.service" "$HOME/.config/systemd/user/" +systemctl --user daemon-reload +systemctl --user enable --now hamclock + cd ~/.local/share/HamPackServer echo "Updating system..." @@ -109,22 +114,6 @@ source packages.conf echo "Installing servers..." install_packages "${SERVERS[@]}" -# Initialize and start MariaDB if not already running -if ! systemctl is-active --quiet mariadb; then - if [ ! -d /var/lib/mysql/mysql ]; then - echo "Initializing MariaDB..." - sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql - fi - echo "Starting MariaDB..." - sudo systemctl enable --now mariadb -fi - -# Start Apache if not already running -if ! systemctl is-active --quiet httpd; then - echo "Starting Apache..." - sudo systemctl enable --now httpd -fi - echo "Installing utilities..." install_packages "${UTILITIES[@]}" @@ -227,7 +216,7 @@ else fi if [ -n "$WAVELOG_DB_PASS" ]; then echo "" - echo "Wavelog database password: $WAVELOG_DB_PASS. Please save this." + echo "Wavelog database password: $WAVELOG_DB_PASS (Please save this.)" echo "(also stored in $WAVELOG_DIR/docker-compose.yaml)" fi echo "" diff --git a/packages.conf b/packages.conf index 0de9a26..2c8e1fe 100644 --- a/packages.conf +++ b/packages.conf @@ -1,7 +1,6 @@ # Ham servers SERVERS=( - apache - mariadb + # nothing at this time ) # Ham server utilities @@ -17,8 +16,6 @@ UTILITIES=( nano nodejs npm - php - php-apache vi wget unzip diff --git a/servicefiles/hamclock.service b/servicefiles/hamclock.service new file mode 100644 index 0000000..f7daeba --- /dev/null +++ b/servicefiles/hamclock.service @@ -0,0 +1,13 @@ +[Unit] +Description=HamClock +After=network.target + +[Service] +Type=simple +WorkingDirectory=%h/.local/bin/ +ExecStart=%h/.local/bin/hamclock +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=default.target diff --git a/servicefiles/openhamclock.service b/servicefiles/openhamclock.service new file mode 100644 index 0000000..5188346 --- /dev/null +++ b/servicefiles/openhamclock.service @@ -0,0 +1,13 @@ +[Unit] +Description=OpenHamClock +After=network.target + +[Service] +Type=simple +WorkingDirectory=%h/.local/bin/openhamclock +ExecStart=/usr/bin/pm2 start server.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=default.target