30 min delay for mail.sh

This commit is contained in:
Hartmut Bauer committed 2025-08-16 13:13:53 +02:00
1 parent eaab960133
commit c89cfe66e9
4 files changed
+163 -18

No files matched your search

+92 -1
View File
@@ -1,3 +1,94 @@
#!/usr/bin/eval bash
# nothing to do
PROTON_TARGET="/Users/hb/mnt/nas/backups/div"
PROTON_TARGET_FILE="proton_mail_pass.$EXT"
PROTON_ROOT="/Users/hb/Downloads"
PROTON_BACKUP_DIR="Proton_Backup"
PROTON_BACKUP="$PROTON_ROOT/$PROTON_BACKUP_DIR"
PROTON_MAIL_EXPORT="$PROTON_ROOT/proton-mail-export-cli"
PROTON_PASS_EXPORT="$PROTON_ROOT/Proton Pass_export"
check_proton() {
if [ ! -d "$PROTON_MAIL_EXPORT" ]; then
mail_log $ERROR "$ERR there is no Proton Mail export."
return 1
fi
# tr ist nötig, weil bei macOS führene blanks entfernt werden müssen
if [ "$(ls "$PROTON_PASS_EXPORT"*|wc -l|tr -d ' ')" != "1" ]; then
mail_log $ERROR "$ERR there is no Proton Pass export."
return 1
fi
if [ ! -d "$PROTON_TARGET" ]; then
mail_log $ERROR "$ERR could not find targe dir $PROTON_TARGET!"
return 1
fi
if [ -f "$PROTON_TARGET/$PROTON_TARGET_FILE" ]; then
log $DEBUG "$DBG > rm -f \"$PROTON_TARGET/$PROTON_TARGET_FILE\""
rm -f "$PROTON_TARGET/$PROTON_TARGET_FILE" >>$LOG_FILE 2>&1
fi
}
delete_proton_backup_dir() {
log $DEBUG "$DBG delete_proton_backup_dir()"
if [ -d "$PROTON_BACKUP" ]; then
log $DEBUG "$DBG > rm -rf \"$PROTON_BACKUP\""
rm -rf "$PROTON_BACKUP" >>$LOG_FILE 2>&1 && return 0
fi
return 1
}
create_proton_backup_dir() {
log $DEBUG "$DBG create_proton_backup_dir()"
delete_proton_backup_dir
log $DEBUG "$DBG > mkdir -p \"$PROTON_BACKUP\""
mkdir -p "$PROTON_BACKUP" >>$LOG_FILE 2>&1 && return 0
return 1
}
move_proton_exports() {
log $DEBUG "$DBG move_proton_exports()"
log $DEBUG "$DBG > mv \"$PROTON_MAIL_EXPORT\" \"$PROTON_BACKUP\""
mv "$PROTON_MAIL_EXPORT" "$PROTON_BACKUP" >>$LOG_FILE 2>&1
if [ $? -ne 0 ]; then return 1; fi
log $DEBUG "$DBG > mv \"$PROTON_PASS_EXPORT\"* \"$PROTON_BACKUP\""
mv "$PROTON_PASS_EXPORT"* "$PROTON_BACKUP" >>$LOG_FILE 2>&1
if [ $? -ne 0 ]; then return 1; fi
}
do_proton_backup() {
log $DEBUG "$DBG do_proton_backup()"
mail_log $INFO "$INF checking environment"
check_proton
is_error $? && return 1
mail_log $INFO "$INF create $PROTON_BACKUP"
create_proton_backup_dir
is_error $? && return 1
mail_log $INFO "$INF move Proton exports to source directory"
move_proton_exports
is_error $? && return 1
mail_log $INFO "$INF backing up Proton exports to $PROTON_TARGET/$PROTON_TARGET_FILE"
backup_directory "$PROTON_ROOT" "$PROTON_TARGET/$PROTON_TARGET_FILE" "$PROTON_BACKUP_DIR"
is_error $? && return 1
}
proton_backup() {
mail_log $INFO ">>>>>>>>>> Proton backup $VER at $HOST_NAME <<<<<<<<<<"
do_proton_backup
mail_log $INFO "$INF deleting $PROTON_BACKUP"
delete_proton_backup_dir
is_error $?
mail_log $DEBUG "$DBG rm -f \"$PROTON_PASS_EXPORT\"*"
mail_log $DEBUG "$(rm -f "$PROTON_PASS_EXPORT"* 2>&1)"
mail_log $INFO ">>>>>>>>>> end of Proton backup"
send_mail_log "Proton Backup"
}