feat: Updates install script

This commit is contained in:
2025-04-21 14:53:16 -04:00
parent c779861eed
commit c8aeafe1a6
2 changed files with 28 additions and 9 deletions

7
docker-restart.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
# Restart all stacks / services located in '/etc/komodo/stacks'.
stackdir="/etc/komodo/stacks"
find "$stackdir" -maxdepth 1 -mindepth 1 -type d -print0 |
xargs -0 -I {} 'cd {} && docker compose up -d'

View File

@@ -4,6 +4,25 @@ baseurl="https://git.housh.dev/homelab/backup/raw/branch/main"
systemdir="/etc/systemd/system"
bindir="/usr/local/bin"
function downloadScripts() {
local scripts=(
"docker-backup"
"docker-restore"
"docker-restart"
)
for script in "${scripts[@]}"; do
# set the destination of the script.
local dest="$bindir/$script"
# Remove the file if it exists.
[ -f "$dest" ] && rm -f "$dest"
# download the script to the destination.
wget "$baseurl/$script.sh" -O "$dest"
# make the script executable.
chmod +x "$dest"
done
}
# Remove backup service file if it exists and install the service file.
[ -f "$systemdir/backup.service" ] &&
systemctl stop backup.timer &&
@@ -15,17 +34,10 @@ wget "$baseurl/backup.service" -O "$systemdir/backup.service"
[ ! -f "$systemdir/backup.timer" ] &&
wget "$baseurl/backup.timer" -O "$systemdir/backup.timer"
# Remove the backup script file if it exists and install the backup script.
[ -f "$bindir/docker-backup" ] && rm -f "$bindir/docker-backup"
wget "$baseurl/docker-backup.sh" -O "$bindir/docker-backup" &&
chmod +x "$bindir/docker-backup"
# Remove the restore script file if it exists and install the restore script.
[ -f "$bindir/docker-restore" ] && rm -f "$bindir/docker-restore"
wget "$baseurl/docker-restore.sh" -O "$bindir/docker-restore" &&
chmod +x "$bindir/docker-restore"
downloadScripts
# Start services
systemctl daemon-reload
systemctl start backup.timer
systemctl start backup.service
systemctl status backup.service