• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Basic Autonomous Backup Script

Scheduled Pinned Locked Moved
Tutorials
1
1
1.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    smshahan
    last edited by Jul 30, 2013, 4:23 PM

    ----------------------------------------------Attach NFS share-----------------------------------------
    Make sure you are in the root directory

    Makes directory nfs#

    1. 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=8192

    Notes:
    {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

    1. Rename fogbackup.sh to fogbackup

    2. Make fogbackup executable for everyone by running chmod +x fogbackup

    3. Navigate to /etc/crontab and edit crontab to include: 00 4 * * * root /etc/cron.daily/fogbackup

    Save and Restart

    That should be it.

    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post

    153

    Online

    12.1k

    Users

    17.3k

    Topics

    155.3k

    Posts
    Copyright © 2012-2024 FOG Project