Update backup scripts

This commit is contained in:
albert 2024-05-08 08:02:08 +09:00
parent 4cd82e45e4
commit 4b126b6b65
Signed by: albert
GPG key ID: 3895DD267CA11BA9
5 changed files with 9 additions and 9 deletions

View file

@ -6,9 +6,8 @@
# All <color> options are of the form <rrggbb[aa]>.
# font-size = 96;
show-failed-attempts = true;
effect-blur = "20x8";
effect-blur = "30x8";
screenshots = true;
fade-in = 0.2;
clock = true;
timestr = "%R";

View file

@ -1,11 +1,11 @@
{ pkgs, ... }:
let
rsync-data-vol = pkgs.writeScriptBin "rsync-data-vol" "${builtins.readFile ./scripts/rsync-data-vol.sh}";
rsync-backups = pkgs.writeScriptBin "rsync-backups" "${builtins.readFile ./scripts/rsync-media.sh}";
rsync-media = pkgs.writeScriptBin "rsync-media" "${builtins.readFile ./scripts/rsync-media.sh}";
rsync-sysctl = pkgs.writeScriptBin "rsync-sysctl" "${builtins.readFile ./scripts/rsync-sysctl.sh}";
in {
environment.systemPackages = [
rsync-backups
rsync-media
rsync-data-vol
rsync-sysctl
];

View file

@ -27,7 +27,8 @@ if [[ $mounted1 != 0 ]] || [[ $mounted2 != 0 ]] || [[ $mounted3 != 0 ]] ; then
fi
# If an old backup is still running, don't continue
if [[ `ps aux | grep $BACKUP_NAME | grep -v grep` ]] ; then
count=$(ps aux | grep $BACKUP_NAME | grep -v grep | wc -l)
if [[ $count -ge 1 ]] ; then
echo -e "$BACKUP_NAME rsync still running. Exiting...."
payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}"
curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload"

View file

@ -27,7 +27,8 @@ if [[ $mounted1 != 0 ]] || [[ $mounted2 != 0 ]] || [[ $mounted3 != 0 ]] ; then
fi
# If an old backup is still running, don't continue
if [[ `ps aux | grep $BACKUP_NAME | grep -v grep` ]] ; then
count=$(ps aux | grep $BACKUP_NAME | grep -v grep | wc -l)
if [[ $count -ge 1 ]] ; then
echo -e "$BACKUP_NAME rsync still running. Exiting...."
payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}"
curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload"

View file

@ -6,10 +6,9 @@ payload="{\"message\": \"$BACKUP_NAME Backup has started\nDate: `date`\", \"prio
curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload"
# If an old backup is still running, don't continue
if [[ `ps aux | grep $BACKUP_NAME | grep -v grep` ]] ; then
count=$(ps aux | grep $BACKUP_NAME | grep -v grep | wc -l)
if [[ $count -ge 1 ]] ; then
echo -e "$BACKUP_NAME rsync still running. Exiting...."
echo "Output: "
ps aux | grep $BACKUP_NAME | grep -v grep
payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}"
curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload"
exit