This commit is contained in:
iFargle 2023-12-15 21:27:38 +09:00
parent f325999058
commit 477b5b0f10
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
rsync-backup = pkgs.writeScriptBin "rsync-backup" '' rsync-backups = pkgs.writeScriptBin "rsync-backups" ''
#!${pkgs.stdenv.shell} #!${pkgs.stdenv.shell}
# Send the gotify notification: # Send the gotify notification:
@ -27,7 +27,7 @@ fi
echo -e "======= Time started : `date`" echo -e "======= Time started : `date`"
if [[ `ps aux | grep rsync | grep -v grep | grep -v rsync-all` ]] ; then if [[ `ps aux | grep rsync | grep -v grep | grep -v rsync-backups` ]] ; then
echo -e "================================================================================" echo -e "================================================================================"
echo -e "rsync still running. Exiting...." echo -e "rsync still running. Exiting...."
echo -e "======= Time complete: `date`" echo -e "======= Time complete: `date`"
@ -113,7 +113,7 @@ curl -X 'POST' 'https://gotify.sysctl.io/message' -H 'accept: application/json'
''; '';
in in
{ {
environment.systemPackages = [ rsync-backup ]; environment.systemPackages = [ rsync-backups ];
# Set up the secret for the password: # Set up the secret for the password:
sops.secrets."gotify_token" = { sops.secrets."gotify_token" = {

View file

@ -4,7 +4,7 @@
systemCronJobs = [ systemCronJobs = [
# Backups from nuc-docker01 - See "backup-script.nix" # Backups from nuc-docker01 - See "backup-script.nix"
# https://git.sysctl.io/albert/random-scripts/src/branch/master/rsync-pi/rsync-all.sh # https://git.sysctl.io/albert/random-scripts/src/branch/master/rsync-pi/rsync-all.sh
''0 9 * * * root rsync-backup >> /root/logs/rsync-backup-`date "+\%Y-\%m-\%d"`'' ''0 9 * * * root rsync-backups >> /root/logs/rsync-backup-`date "+\%Y-\%m-\%d"`''
]; ];
}; };
} }