From 001011ed7615e7204636b91aeb66c9c4f84fe26e Mon Sep 17 00:00:00 2001 From: Antoine Lima Date: Wed, 24 Nov 2021 10:13:07 +0100 Subject: [PATCH] Added scripts to send mail with sucess or fail --- .autorestic.yml | 2 +- .runforget.swp | Bin 0 -> 1024 bytes runcron | 13 +++++++++++++ runforget | 10 ++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .runforget.swp create mode 100755 runcron create mode 100755 runforget diff --git a/.autorestic.yml b/.autorestic.yml index 580f8c1..0628cc9 100644 --- a/.autorestic.yml +++ b/.autorestic.yml @@ -84,7 +84,7 @@ locations: - hdd cron: '0 3 * * 4' # At 3:00am on Thursday - home: + multimedia: from: - /home/yunohost.multimedia/ to: diff --git a/.runforget.swp b/.runforget.swp new file mode 100644 index 0000000000000000000000000000000000000000..bcef0696a43ecb280733a8473e3beb28f377ff82 GIT binary patch literal 1024 zcmYc?$V<%2S1{HyVn6{N#taNa`S~R%f;c!u`N`P@MfrM_c^P_XMK}}zh4oWQlJyfy nOY)0Si%T+-^@~dL((;SaQ;D(!x3Qx#qaiRF0>p(tD7rEL>^~Io literal 0 HcmV?d00001 diff --git a/runcron b/runcron new file mode 100755 index 0000000..08e1e3f --- /dev/null +++ b/runcron @@ -0,0 +1,13 @@ +#! /usr/bin/env bash +autorestic -c /etc/autorestic/.autorestic.yml --ci cron --lean 1> /tmp/autorestic.log 2>/tmp/autorestic-err.log +ret=$? + +if [ "$ret" != 0 ] || [ -s /tmp/autorestic-err.log ] +then + printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-err.log)" | mail -s "Autorestic Backup: Failed" root +else + if [ -s /tmp/autorestic.log ] + then + printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic.log)" | mail -s "Autorestic Backup: Success" root + fi +fi diff --git a/runforget b/runforget new file mode 100755 index 0000000..04e3f1e --- /dev/null +++ b/runforget @@ -0,0 +1,10 @@ +#! /usr/bin/env bash +autorestic -c /etc/autorestic/.autorestic.yml --ci forget --all --prune 1> /tmp/autorestic-prune.log 2>/tmp/autorestic-prune-err.log +ret=$? + +if [ "$ret" != 0 ] || [ -s /tmp/autorestic-prune-err.log ] +then + printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-prune-err.log)" | mail -s "Autorestic Pruning: Failed" root +else + printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic-prune.log)" | mail -s "Autorestic Pruning: Success" root +fi \ No newline at end of file