From 98961a98cb2913baf42fc10132d7436274feb76e Mon Sep 17 00:00:00 2001 From: Daniel Marquardt Date: Fri, 18 Sep 2026 21:39:21 -0700 Subject: [PATCH] Added automation script --- update_rclone.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 update_rclone.sh diff --git a/update_rclone.sh b/update_rclone.sh new file mode 100644 index 0000000..cd664c4 --- /dev/null +++ b/update_rclone.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +### Test for root +if [ "$EUID" -ne 0 ]; then + echo "Must run this script as root." + exit 1 +fi + +### Test for rclone executable and install if not found +RCLONE_BIN="/usr/bin/rclone" + +if [ -f "$RCLONE_BIN" ]; then + echo "rclone installed already" +else + echo "rclone not installed, installing" + curl https://rclone.org/install.sh | bash +fi + +### Grab the files from repo and distribute them to the filesystem +mkdir -p /tmp/rclone && cd /tmp/rclone +git clone https://git.codetical.com/Codetical/rclone-config.git +mv -f /tmp/rclone/rclone-config/etc/rclone.conf /etc/ +rm /etc/systemd/system/rclone@.conf +mv /tmp/rclone/rclone-config/etc/systemd/system/rclone@.conf /etc/systemd/system/ +rm -Rf /etc/rclone +mv /tmp/rclone/rclone-config/etc/rclone /etc/ +chown root:root /etc/rclone.conf +chown root:root -R /etc/rclone +chown root:root /etc/systemd/system/rclone@.conf +rm -Rf /tmp/rclone +systemctl daemon-reload + +### Check for services +SERVICES=( + "rclone@gdBackups.service" + "rclone@gdBooks.service" + "rclone@gdExternal.service" + "rclone@gdInternal.service" + "rclone@gdMedia.service" + "rclone@gdMediaExtra.service" + "rclone@gdProjects.service" + "rclone@gdVault.service" +) + +# Loop through each service in the list +for SERVICE in "${SERVICES[@]}"; do + # Check if the service exists + if systemctl list-unit-files "$SERVICE" &>/dev/null; then + echo "Found: '$SERVICE'. Stopping and disabling..." + systemctl disable --now "$SERVICE" + echo "Found: '$SERVICE'. re-creating and starting..." + systemctl enable --now "$SERVICE" + else + echo "Skipped: '$SERVICE' does not exist on this system." + fi +done +