Add next year archive after previous one
This commit is contained in:
parent
59f018b336
commit
aa87b5c188
|
@ -50,9 +50,16 @@ for d in /home/*/ ; do
|
|||
# add the archive to .muttrc if needed
|
||||
if [ -f $MUTTRC ]; then
|
||||
MUTT_MAILBOXES=$(grep "mailboxes =" $MUTTRC)
|
||||
BACKUP_DIRECTORY=archive-$(date +"%Y")
|
||||
YR=$(date +"%Y")
|
||||
PREV_YR=$((YR - 1))
|
||||
BACKUP_DIRECTORY=archive-$YR
|
||||
PREV_BACKUP_DIRECTORY=archive-$PREV_YR
|
||||
if [[ $MUTT_MAILBOXES != *$BACKUP_DIRECTORY* ]]; then
|
||||
sed -i "s|$MUTT_MAILBOXES|$MUTT_MAILBOXES =$BACKUP_DIRECTORY|g" $MUTTRC
|
||||
if [[ $MUTT_MAILBOXES == *$PREV_BACKUP_DIRECTORY* ]]; then
|
||||
sed -i "s|$PREV_BACKUP_DIRECTORY|$PREV_BACKUP_DIRECTORY =$BACKUP_DIRECTORY|g" $MUTTRC
|
||||
else
|
||||
sed -i "s|$MUTT_MAILBOXES|$MUTT_MAILBOXES =$BACKUP_DIRECTORY|g" $MUTTRC
|
||||
fi
|
||||
chown $USERNAME:$USERNAME $MUTTRC
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue