Add crontab, modify mgmt script, temp VPN fix

This commit is contained in:
mr-vercetti 2025-01-02 21:16:59 +01:00
parent 24f4ec532f
commit 94994a678f
3 changed files with 60 additions and 19 deletions

6
crontab Normal file
View File

@ -0,0 +1,6 @@
# SnapRAID
30 4 * * 0 python3 /opt/snapraid-runner/snapraid-runner.py --conf /etc/snapraid-runner.conf --ignore-deletethreshold
# LG TV renew dev mode (https://github.com/webosbrew/dev-manager-desktop)
0 * * * * /etc/tv-renew-devmode.sh >> /var/log/tv-renew-devmode.log 2>&1
# DNS issues fix with Torguard
0 5 * * * /apps/homeserver/docker/torguard-fix.sh

View File

@ -1,27 +1,50 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Please provide command to execute: 'up', 'stop' or 'restart'"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ $# -lt 1 ]; then
echo "Please provide command to execute: 'up', 'stop', 'restart', or 'recreate'"
exit 1
fi
command="$1"
for stack in stacks/*/*
do
case "$command" in
"up")
docker-compose -f "${stack}" --env-file .env up -d
;;
"stop")
docker-compose -f "${stack}" --env-file .env stop
;;
"restart")
docker-compose -f "${stack}" --env-file .env restart
;;
*)
echo "Wrong command. Please use 'up', 'stop' or 'restart'"
case "$command" in
"up")
for stack in "$BASE_DIR"/stacks/*/*
do
docker-compose -f "${stack}" --env-file "$BASE_DIR/.env" up -d
done
;;
"stop" | "restart")
for stack in "$BASE_DIR"/stacks/*/*
do
docker-compose -f "${stack}" --env-file "$BASE_DIR/.env" $command
done
;;
"recreate")
if [ $# -lt 3 ]; then
echo "Please provide both the stack name and the service to recreate"
echo "Usage: $0 recreate <stack_name> <service_name>"
exit 1
;;
esac
done
fi
stack_name="$2"
service="$3"
stack_file="$BASE_DIR/stacks/${stack_name}/${stack_name}.yml"
if [ ! -f "$stack_file" ]; then
echo "Stack file '$stack_file' does not exist"
exit 1
fi
docker-compose -f "${stack_file}" --env-file "$BASE_DIR/.env" stop "$service"
docker-compose -f "${stack_file}" --env-file "$BASE_DIR/.env" rm -f "$service"
docker-compose -f "${stack_file}" --env-file "$BASE_DIR/.env" up -d "$service"
;;
*)
echo "Wrong command. Please use 'up', 'stop', 'restart', or 'recreate'"
exit 1
;;
esac

12
docker/torguard-fix.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
dir="/apps/homeserver/docker/appdata/gluetun/wireguard"
file="$dir/wg0.conf"
file_old="$dir/wg0.conf.old"
file_tmp="$dir/wg0.conf.tmp"
mv $file $file_tmp
mv $file_old $file
mv $file_tmp $file_old
bash /apps/homeserver/docker/mgmt.sh recreate media qbittorrentvpn