Update backup scripts
This commit is contained in:
parent
4cd82e45e4
commit
4b126b6b65
5 changed files with 9 additions and 9 deletions
|
@ -6,9 +6,8 @@
|
||||||
# All <color> options are of the form <rrggbb[aa]>.
|
# All <color> options are of the form <rrggbb[aa]>.
|
||||||
# font-size = 96;
|
# font-size = 96;
|
||||||
show-failed-attempts = true;
|
show-failed-attempts = true;
|
||||||
effect-blur = "20x8";
|
effect-blur = "30x8";
|
||||||
screenshots = true;
|
screenshots = true;
|
||||||
fade-in = 0.2;
|
|
||||||
|
|
||||||
clock = true;
|
clock = true;
|
||||||
timestr = "%R";
|
timestr = "%R";
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
rsync-data-vol = pkgs.writeScriptBin "rsync-data-vol" "${builtins.readFile ./scripts/rsync-data-vol.sh}";
|
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}";
|
rsync-sysctl = pkgs.writeScriptBin "rsync-sysctl" "${builtins.readFile ./scripts/rsync-sysctl.sh}";
|
||||||
in {
|
in {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
rsync-backups
|
rsync-media
|
||||||
rsync-data-vol
|
rsync-data-vol
|
||||||
rsync-sysctl
|
rsync-sysctl
|
||||||
];
|
];
|
||||||
|
|
|
@ -27,7 +27,8 @@ if [[ $mounted1 != 0 ]] || [[ $mounted2 != 0 ]] || [[ $mounted3 != 0 ]] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If an old backup is still running, don't continue
|
# 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 -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\"}"
|
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"
|
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"
|
||||||
|
|
|
@ -27,7 +27,8 @@ if [[ $mounted1 != 0 ]] || [[ $mounted2 != 0 ]] || [[ $mounted3 != 0 ]] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If an old backup is still running, don't continue
|
# 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 -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\"}"
|
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"
|
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"
|
||||||
|
|
|
@ -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"
|
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 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 -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\"}"
|
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"
|
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
|
exit
|
||||||
|
|
Loading…
Reference in a new issue