feat: Updates install script
This commit is contained in:
7
docker-restart.sh
Normal file
7
docker-restart.sh
Normal 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'
|
||||||
30
install.sh
30
install.sh
@@ -4,6 +4,25 @@ baseurl="https://git.housh.dev/homelab/backup/raw/branch/main"
|
|||||||
systemdir="/etc/systemd/system"
|
systemdir="/etc/systemd/system"
|
||||||
bindir="/usr/local/bin"
|
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.
|
# Remove backup service file if it exists and install the service file.
|
||||||
[ -f "$systemdir/backup.service" ] &&
|
[ -f "$systemdir/backup.service" ] &&
|
||||||
systemctl stop backup.timer &&
|
systemctl stop backup.timer &&
|
||||||
@@ -15,17 +34,10 @@ wget "$baseurl/backup.service" -O "$systemdir/backup.service"
|
|||||||
[ ! -f "$systemdir/backup.timer" ] &&
|
[ ! -f "$systemdir/backup.timer" ] &&
|
||||||
wget "$baseurl/backup.timer" -O "$systemdir/backup.timer"
|
wget "$baseurl/backup.timer" -O "$systemdir/backup.timer"
|
||||||
|
|
||||||
# Remove the backup script file if it exists and install the backup script.
|
downloadScripts
|
||||||
[ -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"
|
|
||||||
|
|
||||||
# Start services
|
# Start services
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl start backup.timer
|
systemctl start backup.timer
|
||||||
systemctl start backup.service
|
systemctl start backup.service
|
||||||
|
systemctl status backup.service
|
||||||
|
|||||||
Reference in New Issue
Block a user