Skip to content

Instantly share code, notes, and snippets.

@aymencis
Created June 25, 2015 18:01
Show Gist options
  • Save aymencis/ce573477a491a4d1d2fe to your computer and use it in GitHub Desktop.
Save aymencis/ce573477a491a4d1d2fe to your computer and use it in GitHub Desktop.
OVH NFS BACKUP
#!/bin/sh
# BACKUP SCRIPT
CONTACT="[email protected]"
MAIL="/tmp/mail"
if [ -e "/var/lock/backup.lock" ]
then
echo " BACKUP ALREADY STARTED !!" > $MAIL
cat $MAIL | mail -s "BACKUP REPORT" $CONTACT
rm $MAIL
else
touch /var/lock/backup.lock
echo "================================" >> $MAIL
echo "BACKUP STARTED: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "================================" >> $MAIL
echo " MOUNT NFS: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
mount -t nfs ftpback-rbx3-312.ovh.net:/export/ftpbackup/ns123456.ip-12-345-678.eu /mnt/backup
echo "" >> $MAIL
echo "" >> $MAIL
echo "================================" >> $MAIL
echo "COPY /var: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
rsync -avz /var /mnt/backup/ > /root/backup/backup.log
echo "" >> $MAIL
echo "" >> $MAIL
echo "/var COPIED " >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "================================" >> $MAIL
echo "COPY /etc: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
rsync -avz /etc /mnt/backup/ >> /root/backup/backup.log
echo "/etc COPIED " >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "================================" >> $MAIL
echo " UMOUNT NFS: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
umount /mnt/backup
echo "" >> $MAIL
echo "" >> $MAIL
echo " NFS UMOUNTED " >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "================================" >> $MAIL
echo " BACKUP FINISHED: `date +%c` " >> $MAIL
echo "================================" >> $MAIL
cat $MAIL | mail -s "BACKUP REPORT" $CONTACT
rm $MAIL
rm /var/lock/backup.lock
fi
@singpolyma
Copy link

Do you find that the NFS on OVH pancakes all your owners/groups to useless ones and always allows full read/write to any user on your dedicated box? I think their exports are just very limited, but trying to confirm if there's anything I can do to improve the situation...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment