GithubHelp home page GithubHelp logo

backrunner's Introduction

BackRunner

Utility to routinely backup local file server to store, and automatically manage monthly backups

Setup

Here's a brief overview of the setup process I'm using:

  • Install NTFS-3g with sudo apt-get install -y ntfs-3g
  • Run sudo blkid to get UUID of local drive
  • Run sudo mkdir /mnt/backup && sudo mkdir /mnt/remote to create paths to mount things

Mounting

First, make sure that you've mounted both your remote drive and local drive to /mnt/remote and /mnt/backup, respectively

Example fstab command for loading remote store:

//192.168.1.169/home /mnt/remote cifs vers=1.0,user=ExampleUser,password=ExamplePassword,x-systemd.automount,ro 0 0

Running Locally

The first time I'm running the script, I like to run it locally. The following command will do so:

sudo nohup sudo rm /mnt/backup/log.txt ; sudo bash /mnt/backup/runner.sh > log.txt 2>&1 &

This command will add all output to log.txt, a local file that you can then read remotely to ensure that it is working. All output will be appended there, including rsync's output in verbose mode.

Setting up Crontab

Of course, you want to reconfigure this to work on your system, but here's how I have my crontab set up:

[email protected]

26 5 * * * /bin/bash /mnt/backup/runner.sh

This will run the backup every day at 5:26AM (frc team heh)

In addition, it will email me the output when it is finished. The script automatically detects that cron is running it and turns off rsync verbose mode.

Retreiving the Backup

Oh no! What if your files are gone?

Well, this hasn't happened to me yet, so I might update this if it does, but here's one command that could be used to transfer files over secure shell (note: untested). Alternatively, you could use rsync.

scp -r [email protected]:/mnt/backup .

Finally, here's the command I use to copy all the remote files of importance to my desktop:

scp -r [email protected]:/mnt/backup/\{runner.sh,backupUtil.sh,runLog.txt\} ./

backrunner's People

Contributors

aaroexxt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.