Skip to content

Commit

Permalink
Merge pull request #1431 from dmwm/arooshap-patch-6
Browse files Browse the repository at this point in the history
Update mongo_manage.sh
  • Loading branch information
arooshap authored Oct 20, 2023
2 parents 1ab4f44 + 172b93a commit 7cd8292
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docker/mongodb/source/mongotools/mongo_manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ if [ -z "$CONFIG" ]; then
usage
exit 1
fi
if [ -z "$AGE_KEY" ]; then
echo "AGE_KEY environment is not set, please generate appropriate key file"
echo "using age-keygen and point this environment to it"
exit 1
fi

# how to encrypt file with age
# age -i $AGE_KEY --encrypt file.txt > file.encrypted
Expand All @@ -43,6 +38,11 @@ init(){
PASSWORD=`cat $CONFIG | grep PASSWORD | sed -e "s,PASSWORD=,,g"`
BACKUP_DIR=`cat $CONFIG | grep BACKUP_DIR | sed -e "s,BACKUP_DIR=,,g"`
else
if [ -z "$AGE_KEY" ]; then
echo "AGE_KEY environment is not set, please generate appropriate key file"
echo "using age-keygen and point this environment to it"
exit 1
fi
# we got encrypted config
URI=`age -i $AGE_KEY --decrypt -o - $CONFIG | grep URI | sed -e "s,URI=,,g"`
HOST=`age -i $AGE_KEY --decrypt -o - $CONFIG | grep HOST | sed -e "s,HOST=,,g"`
Expand Down Expand Up @@ -106,7 +106,7 @@ backup()
--out="$BACKUP_DIR/$DATE" \
--db="$dbName"
done
sudo find $BACKUP_DIR -mindepth 1 -maxdepth 1 -type d -ctime +10 | xargs sudo rm -rf;
find $BACKUP_DIR -mindepth 1 -maxdepth 1 -type d -ctime +10 | xargs sudo rm -rf;
}

restore()
Expand All @@ -128,7 +128,7 @@ restore()
--password="$PASSWORD" \
--db="$dbName"
done
sudo find $BACKUP_DIR -mindepth 1 -maxdepth 1 -type d -ctime +10 | xargs sudo rm -rf;
sudo find $BACKUP_DIR -mindepth 1 -maxdepth 1 -type d -ctime +10 | xargs rm -rf;
}

backup_status()
Expand Down

0 comments on commit 7cd8292

Please sign in to comment.