first commit 🚀
This commit is contained in:
commit
9d6f036ead
4 changed files with 128 additions and 0 deletions
24
backup.sh
Normal file
24
backup.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
HOSTNAME=$(hostname -s)
|
||||
IP=
|
||||
SOURCE=/opt/backup/
|
||||
DEST=/volume2/backup
|
||||
NTFY_TOKEN=
|
||||
NTFY_CHANNEL=https://ntfy.exmaple.tld/backups
|
||||
|
||||
if ping -c 1 $IP &> /dev/null
|
||||
then
|
||||
echo "> success"
|
||||
# Delete old rsync.log
|
||||
rm /var/log/rsync.log
|
||||
# Mount synology nfs share
|
||||
/usr/bin/mount $IP:$DEST/$HOSTNAME /mnt/backup/
|
||||
# Backup files with rsync
|
||||
rsync --log-file=/var/log/rsync.log --delete --stats -rlhPt $SOURCE /mnt/backup \
|
||||
&& curl -H "Authorization: Bearer $NTFY_TOKEN" -H prio:low -d "docker-01: backup to nas succeeded" $NTFY_CHANNEL \
|
||||
|| curl -H "Authorization: Bearer $NTFY_TOKEN" -H tags:warning -H prio:high -d "docker-01: backup to nas failed" $NTFY_CHANNEL
|
||||
# Unmount nfs share
|
||||
/usr/bin/umount /mnt/backup/
|
||||
else
|
||||
echo "> error"
|
||||
fi
|
24
check-ssl.sh
Normal file
24
check-ssl.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Test SSL/TLS
|
||||
|
||||
GREEN=$(tput setaf 2)
|
||||
CYAN=$(tput setaf 6)
|
||||
RESET=$(tput sgr0)
|
||||
|
||||
echo -e "${CYAN}"
|
||||
echo " > testssl.sh is a free command line tool"
|
||||
echo " > which checks a server's service on any port"
|
||||
echo " > for the support of TLS/SSL ciphers,"
|
||||
echo " > protocols as well as some cryptographic flaws."
|
||||
|
||||
echo ""
|
||||
echo " > Find more @ https://github.com/drwetter/testssl.sh"
|
||||
|
||||
echo -e "$GREEN"
|
||||
echo " > Bitte gib die komplette URL (z.B. https://test.example.com) an."
|
||||
read -p " > Welche Webseite soll getestet werden? " WEBSITE
|
||||
echo -e "${RESET}"
|
||||
|
||||
docker pull drwetter/testssl.sh
|
||||
|
||||
docker run --rm -ti drwetter/testssl.sh $WEBSITE
|
38
container-update.sh
Normal file
38
container-update.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/docker/**/docker-compose.yml; do
|
||||
if [[ $(docker compose -f "$compose_file" ps -q) ]]; then
|
||||
echo "> Updating $compose_file"
|
||||
docker compose -f "$compose_file" pull
|
||||
docker compose -f "$compose_file" up -d --remove-orphans
|
||||
echo ""
|
||||
else
|
||||
echo "> Skipping $compose_file as it's not running."
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
echo "> Containers have been updated."
|
||||
echo ""
|
||||
|
||||
confirm=n
|
||||
read -p "
|
||||
> Do you want to prune docker? [y/N]
|
||||
> WARNING! This will remove:
|
||||
> - all stopped containers
|
||||
> - all networks not used by at least one container
|
||||
> - all dangling images
|
||||
> - unused build cache
|
||||
" confirm
|
||||
echo ""
|
||||
|
||||
if [[ $confirm == [yY] ]]; then
|
||||
docker system prune -f -a
|
||||
echo "> Docker has been pruned."
|
||||
else
|
||||
echo "> Nothing has been changed."
|
||||
fi
|
||||
|
||||
exit
|
42
copy.sh
Normal file
42
copy.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
IP=
|
||||
SOURCE=/opt/docker/
|
||||
DEST=/volume2/video/uploads
|
||||
|
||||
if ping -c 1 $IP &> /dev/null
|
||||
then
|
||||
echo "> success"
|
||||
|
||||
# Delete old rsync.log
|
||||
rm /var/log/rsync.log
|
||||
|
||||
# Mount synology nfs share
|
||||
echo "> mounting nfs share"
|
||||
/usr/bin/mount $IP:$DEST /mnt/uploads/
|
||||
|
||||
# Copy files with rsync
|
||||
echo "> syncing files"
|
||||
rsync --log-file=/var/log/rsync.log --stats -rlhPt $SOURCE/ /mnt/uploads
|
||||
|
||||
# Unmount nfs share
|
||||
echo "> unmounting nfs share"
|
||||
/usr/bin/umount /mnt/uploads/
|
||||
|
||||
# if rsync is successful, remove all files
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
rm -rf rm $SOURCE/*
|
||||
echo "> synced files have been removed from source"
|
||||
else
|
||||
echo "> error"
|
||||
echo "> see /var/log/rsync.log"
|
||||
echo "> exit"
|
||||
exit
|
||||
fi
|
||||
|
||||
else
|
||||
echo "> error"
|
||||
echo "> cannot reach server"
|
||||
echo "> exit"
|
||||
exit
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue