Here is a small backup script in the Bash in Linux:
#!/bin/bash
#create the date
datum=$(date --utc --date "$1" +%x)
#hello to the user with the current date
echo "Hallo" ${USER^} "heute ist der" $datum
#checking the disc space on /home/sven
echo "Frei sind auf dem Homeverzeichnis noch"
df -h /home/sven | awk 'NR==2 {print $4}'
#creating the backup of the database: artikel in the collection Nachrichten with the current date
echo "Backup MongoDB Collection Nachrichten"
mongoexport --db Artikel --collection Nachrichten --type=json --out=Nachrichten_$datum.json
sleep 2
#creating the backup of the database: Lander in the collection Espana with the current date
echo "Backup MongoDB Collection Espana"
mongoexport --db Laender --collection Espana --type=json --out=Espana_$datum.json
#notification that the backups were made
notify-send "Backups wurden gemacht"
Top comments (0)