Email Newsletter icon, E-mail Newsletter icon, Email List icon, E-mail List icon Sign up for our Email Newsletter




Linux Backup with TAR and Cron Jobs

Info

  • Level: Intermediate
  • Presenter: Eli the Computer Guy
  • Date Created: September 21, 2010
  • Length of Class: 35 Minutes

Tracks

Prerequisites

  1. Introduction to Linux
  2. Installing Linux
  3. Basic Linux Tasks
  4. VIM for File Editing
  5. Navigation in Linux
  6. Users, Groups and Permissions in Linux

Purpose of Class

  • This class teaches students how to backup directories using TAR, and demonstrates how to schedule tasks using Cron Jobs.

Topics Covered

  • Backing Up Directories with TAR
  • Recovering Directories with TAR
  • Setting Up Cron Jobs for Scheduled Tasks

Class Notes

    1. Backup Using TAR
      1. Backup = sudo tar –cvpzf backup.taz.gz –exclude/=directory (recursive) PATH
      2. –c = create new file (overwrites old file)
      3. –v = verbose
      4. –p = preserve permissions
      5. –z = compress
      6. –f = filename (very important)
      7. –exclude=DIRCECTORY is Recursive
      8. Naming Files with time =  filename-$(date +%F-%T)
    2. Recover Files from a TAR File
      1. Recover = sudo tar –xvpzf FILE –C /DIRECTORY
        1. Capital -C = change to directory
        2. -x = extract
    3. Cron Jobs
      1. To Edit the Crontab File = sudo cron –e (first time it will ask you your default editor)
      2. Format = minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
      3. * Wildcard for Every Minute/Day/Hour/Month?Day of Week
      4. Example to Backup Entire Server for 1am Every Morning = 0 1 * * * sudo tar -cvpzf /backup.tar.gz –exclude=/mnt /

Resources



Eli the Computer Guy (437 Posts)

Eli the Computer Guy has 16 years experience in technology being the guy to fix "it". From the Army, to building out new satellite offices for the enterprise, to running his own shop with 9 full time employees Eli has real world experience with almost all systems that technicians will be working with. Eli has 1600 hours of formal technical beyond his Bachelors Degree in Criminal Justice on technologies ranging from Avaya PBX/ Audix to Microsoft, Red Hat Linux, MySQL, Cisco and much more.


  • Vishu Jain

    Your videos are very much helpful. Thankyou sir,,,

  • Jérémie

    I think you have inverted 2 videos at 20min of the video before “Cron Jobs”

  • Alex

    Regarding cron jobs
    the command you used in the example uses: sudo bla bla bla
    But if you are running this, say, once a month and you use “sudo” in the crontab job. How does the system know about root authentication? will it prompt you once a month at 2 AM for root’s password? -of course you will not be there at 2 AM- I see that your example was every minute and you just did a “sudo crontab -e” meaning root password was still valid for the your example.

    Please clarify what happens with the sudo prompt when used in a cron job i.e. system prompts you for root’s password.

  • Paul Miningwa

    awesome

  • Ronnie

    your a creat teacher!
    I have much learned of your videos :D
    But I want to learn more about linux (ubuntu) command etc.
    Are you planning to make more videos about linux or do you know a good website or whatever where I can learn more about it?
    again thank you for all your lessions/tutorials about linux :)



















Subscribe to me on YouTube