Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:dovecot_backup_-_skript

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
tachtler:dovecot_backup_-_skript [2023/07/03 18:21] – [Skript] klaustachtler:dovecot_backup_-_skript [2023/07/05 19:07] (aktuell) – [Dovecot Backup - Skript] klaus
Zeile 12: Zeile 12:
  
 ^ Beschreibung  ^ Externer Link                                                                   ^ ^ Beschreibung  ^ Externer Link                                                                   ^
-| Linux-Magazin | [[http://www.linux-magazin.de/ausgaben/2018/06/backups-von-e-mails/|Wie Admins ihre Mailserver vor Datenverlust schützen]] / {{ :tachtler:protected:054-058_email_backup_v2.pdf |Artikel aus Ausgabe 06/2018}} |+| Linux-Magazin | [[http://www.linux-magazin.de/ausgaben/2018/06/backups-von-e-mails/|Wie Admins ihre Mailserver vor Datenverlust schützen]]\\ [[https://www.linux-magazin.de/ausgaben/2018/06/backups-von-e-mails/4/|Wie Admins ihre Mailserver vor Datenverlust schützen (Seite 4) - Erwähnung]]\\ {{ :tachtler:protected:054-058_email_backup_v2.pdf |Artikel aus Ausgabe 06/2018 - geschützt}} |
 | Homepage      | [[http://dovecot.org|http://dovecot.org]]                                       | | Homepage      | [[http://dovecot.org|http://dovecot.org]]                                       |
 | Dokumentation | [[http://dovecot.org/documentation.html|http://dovecot.org/documentation.html]] | | Dokumentation | [[http://dovecot.org/documentation.html|http://dovecot.org/documentation.html]] |
Zeile 239: Zeile 239:
 #                                                                            # #                                                                            #
 # Last update : 03.07.2023                                                   # # Last update : 03.07.2023                                                   #
-# Version     : 1.19                                                         #+# Version     : 1.20                                                         #
 #                                                                            # #                                                                            #
 # Author      : Klaus Tachtler, <klaus@tachtler.net>                         # # Author      : Klaus Tachtler, <klaus@tachtler.net>                         #
Zeile 368: Zeile 368:
 # -------------------------------------------------------------------------- # # -------------------------------------------------------------------------- #
 # Version     : 1.18                                                         # # Version     : 1.18                                                         #
 +# Description : Introduction of zstd compression as an alternative choice to #
 +#               gzip compression. So now by setting the variable COMPRESSION #
 +#               the type of compression can be selected between zst and gz.  #
 +#               The zstd compression can lower the execution time by half.   #
 +#               The design of the code was also revised.                     #
 +#               The error handling was also been improved.                   #
 +#               Thanks to Marco De Lellis.                                   #
 +# -------------------------------------------------------------------------- #
 +# Version     : 1.19                                                         #
 # Description : GitHub: Issue #24                                            # # Description : GitHub: Issue #24                                            #
 #               Correct the license mismatch between GitHub and the script.  # #               Correct the license mismatch between GitHub and the script.  #
 #               Thanks to David Haerdeman (Alphix).                          # #               Thanks to David Haerdeman (Alphix).                          #
 # -------------------------------------------------------------------------- # # -------------------------------------------------------------------------- #
-# Version     : 1.19                                                         #+# Version     : 1.20                                                         #
 # Description : GitHub: Pull request #26                                     # # Description : GitHub: Pull request #26                                     #
 #               Improved FreeBSD compatibility.                              # #               Improved FreeBSD compatibility.                              #
Zeile 388: Zeile 397:
 # CUSTOM - Script-Name. # CUSTOM - Script-Name.
 SCRIPT_NAME='dovecot_backup' SCRIPT_NAME='dovecot_backup'
 +
 +# CUSTOM - Backup-Files compression method - (possible values: gz zst).
 +COMPRESSION='gz'
  
 # CUSTOM - Backup-Files. # CUSTOM - Backup-Files.
 TMP_FOLDER='/srv/backup' TMP_FOLDER='/srv/backup'
 DIR_BACKUP='/srv/backup' DIR_BACKUP='/srv/backup'
-FILE_BACKUP=dovecot_backup_`date '+%Y%m%d_%H%M%S'`.tar.gz +FILE_BACKUP=dovecot_backup_`date '+%Y%m%d_%H%M%S'`.tar.$COMPRESSION 
-FILE_DELETE='*.tar.gz'+FILE_DELETE=$(printf '*.tar.%s$COMPRESSION)
 BACKUPFILES_DELETE=14 BACKUPFILES_DELETE=14
  
Zeile 414: Zeile 426:
  
 # CUSTOM - Mail-Recipient. # CUSTOM - Mail-Recipient.
-MAIL_RECIPIENT='root@tachtler.net'+MAIL_RECIPIENT='you@example.com'
  
 # CUSTOM - Status-Mail [Y|N]. # CUSTOM - Status-Mail [Y|N].
Zeile 425: Zeile 437:
 # Variables. # Variables.
 TAR_COMMAND=`command -v tar` TAR_COMMAND=`command -v tar`
 +GZIP_COMMAND=`command -v gzip`
 +ZSTD_COMMAND=`command -v zstd`
 TOUCH_COMMAND=`command -v touch` TOUCH_COMMAND=`command -v touch`
 RM_COMMAND=`command -v rm` RM_COMMAND=`command -v rm`
Zeile 589: Zeile 603:
 log "" log ""
 log "OS_TYPE.....................: $OSTYPE" log "OS_TYPE.....................: $OSTYPE"
 +log ""
 +log "COMPRESSION.................: $COMPRESSION"
 log "" log ""
 log "TMP_FOLDER..................: $TMP_FOLDER" log "TMP_FOLDER..................: $TMP_FOLDER"
Zeile 599: Zeile 615:
 log "FILE_USERLIST_VALIDATE_EMAIL: $FILE_USERLIST_VALIDATE_EMAIL" log "FILE_USERLIST_VALIDATE_EMAIL: $FILE_USERLIST_VALIDATE_EMAIL"
 log "" log ""
 +
 +# Check if compress extension is allowed.
 +if [[ $COMPRESSION != 'zst' && $COMPRESSION != 'gz' ]]; then
 +        logline "Check compression extension" false
 +        log ""
 +        log "ERROR: Compression extension $COMPRESSION unsupported: choose between gz and zst"
 +        log ""
 +        error 19
 +fi
  
 # Check if command (file) NOT exist OR IS empty. # Check if command (file) NOT exist OR IS empty.
Zeile 615: Zeile 640:
 checkcommand $STAT_COMMAND checkcommand $STAT_COMMAND
 checkcommand $PROG_SENDMAIL checkcommand $PROG_SENDMAIL
 +
 +if [ $COMPRESSION = 'gz' ]; then
 +        checkcommand $GZIP_COMMAND
 +fi
 +
 +if [ $COMPRESSION = 'zst' ]; then
 +        checkcommand $ZSTD_COMMAND
 +fi
  
 # Check if LOCK file NOT exist. # Check if LOCK file NOT exist.
Zeile 938: Zeile 971:
 END_TIMESTAMP=`$DATE_COMMAND '+%s'` END_TIMESTAMP=`$DATE_COMMAND '+%s'`
 if [ "$OSTYPE" = "FreeBSD" ]; then if [ "$OSTYPE" = "FreeBSD" ]; then
- DIFF_TIMESTAMP=$(($RUN_TIMESTAMP-$END_TIMESTAMP)) +        DELTA=$((END_TIMESTAMP-RUN_TIMESTAMP)) 
- log "Runtime: `$DATE_COMMAND -r $DIFF_TIMESTAMP +'%H:%M:%S'time elapsed."+        log "$(printf 'Runtime: %02d:%02d:%02d time elapsed.\n' $((DELTA/3600)) $((DELTA%3600/60)) $((DELTA%60)))"
 else else
  log "Runtime: `$DATE_COMMAND -u -d "0 $END_TIMESTAMP seconds - $RUN_TIMESTAMP seconds" +'%H:%M:%S'` time elapsed."  log "Runtime: `$DATE_COMMAND -u -d "0 $END_TIMESTAMP seconds - $RUN_TIMESTAMP seconds" +'%H:%M:%S'` time elapsed."
Zeile 1002: Zeile 1035:
  
 SCRIPT_NAME.................: dovecot_backup SCRIPT_NAME.................: dovecot_backup
 +
 +OS_TYPE.....................: linux-gnu
  
 COMPRESSION.................: gz COMPRESSION.................: gz
Zeile 1085: Zeile 1120:
  
 SCRIPT_NAME.................: dovecot_backup SCRIPT_NAME.................: dovecot_backup
 +
 +OS_TYPE.....................: linux-gnu
  
 COMPRESSION.................: gz COMPRESSION.................: gz
tachtler/dovecot_backup_-_skript.1688401296.txt.gz · Zuletzt geändert: 2023/07/03 18:21 von klaus