Basic Autonomous Backup Script
-
----------------------------------------------Attach NFS share-----------------------------------------
Make sure you are in the root directoryMakes directory nfs#
- root@FOGServer:~# mkdir /nfs
#Mount Shared Directory (from Client)#
2a) root@FOGServer:~# mount -o soft,intr,rsize=8192,wsize=8192 \ {ENTER}2b) <ip address>:/share location /nfs {ENTER}
#Mount NFS Automatically After Reboot#
3) Navigate to /etc/fstab and add the following line:
<ip address>:/share location /nfs nfs soft,intr,rsize=8192,wsize=8192Notes:
{ENTER} = Press Enter. It’s not code.
Example of my ip address layout: 192.168.1.2:/mnt/Location/FOGDB
Personally I use a mount point in NAS4Free for my nfs share---------------------------------Backup Script and Cron Task-----------------------------------------
1a) Create a backup script and name it fogbackup.sh
1b) Include the following contents:#!/bin/sh
dte=date +%F
backup=“/nfs/${dte}.sql”;
echo " Starting backup…“;
echo " Backup Location:”
echo " $backup";
sleep 5;
mysqldump --host=localhost --user=root --allow-keywords -f fog > $backup
echo " Backup completed."1c) Add fogbackup.sh to folder /etc/cron.daily
-
Rename fogbackup.sh to fogbackup
-
Make fogbackup executable for everyone by running chmod +x fogbackup
-
Navigate to /etc/crontab and edit crontab to include: 00 4 * * * root /etc/cron.daily/fogbackup
Save and Restart
That should be it.