99fi
1010
1111TODAY=$( date ' +%Y-%m-%d' ) # format date 2020-06-28
12- BACKUP_FOLDER_PATH=/home/panda/Documents/Backups/ # path for the output
12+ BACKUP_FOLDER_PATH=/home/panda/Documents/Backups/Thunderbird/ # path for the output
1313BACKUP_FILENAME=thunderbird-profile-$TODAY # name of the generated back up
1414THUNDERBIRD_PROFILE_PATH=/home/panda/.thunderbird/panda.default-release # path to the profile to save
15- LOCK_FILE_PATH=/home/panda/Documents/Backups/thunderbird-backup.lock # path to the temporary lock file
15+ LOCK_FILE_PATH=/home/panda/Documents/Backups/Thunderbird/ thunderbird-backup.lock # path to the temporary lock file
1616IS_THUNDERBIRD_RUNNING=0
1717ATTEMPTS_TO_STOP_THUNDERBIRD=5
1818
1919# -----------------------------------------------------------------------
20-
21- # TODO Protect contre le controle + C pour fermer le script et ask un confirmation
2220# TODO Ne pas avoir plus de 3 sauvegarde, trouver le moyen de supprimer les vieilles
23- # TODO Faire un fichier de log
24- # TODO Faire une copie sur un remote ou bien sur disque a mount => créer une seconde option pour avoir un second chemin de back up sur un disque de save.
25- # TODO Faire un readme
26-
2721# -----------------------------------------------------------------------
2822
2923# Check if the file already exists
10599
106100# -----------------------------------------------------------------------
107101
108- # Now we can do backup, note: to disable silent mode remove below ">/dev/null" and "-q" flag
102+ # Now we can do backup, note: to disable silent mode remove below ">/dev/null"
109103
110104echo " Thunderbird backup in progress..."
111105pushd $THUNDERBIRD_PROFILE_PATH > /dev/null || exit
@@ -125,6 +119,12 @@ echo "The Lock file has already been removed."
125119
126120# -----------------------------------------------------------------------
127121
122+ # Check if there is file older than one week and remove it
123+ find $BACKUP_FOLDER_PATH /* -type f -mtime +2 -exec rm -f {} \; &&
124+ echo " Oldest backup successfully removed."
125+
126+ # -----------------------------------------------------------------------
127+
128128# Show notify message that backup is created
129129
130130if [ -f " $BACKUP_FOLDER_PATH /$BACKUP_FILENAME .tar.gz" ]; then
136136 zenity --error --text " Thunderbird backup hasn't created.\nUnexpected error occurred." --width=400
137137 fi
138138fi
139- # -----------------------------------------------------------------------
139+
140+ # -----------------------------------------------------------------------
0 commit comments