{"id":232,"date":"2016-03-06T16:19:44","date_gmt":"2016-03-06T21:19:44","guid":{"rendered":"http:\/\/easy-admin.ca\/wordpress\/?p=232"},"modified":"2017-03-17T10:21:26","modified_gmt":"2017-03-17T14:21:26","slug":"linux-backup-with-tar-and-cron-jobs","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2016\/03\/06\/linux-backup-with-tar-and-cron-jobs\/","title":{"rendered":"Linux Backup with TAR and Cron"},"content":{"rendered":"<p>[flowplayer src=&#8221;https:\/\/easy-admin.ca\/my_uploads\/2016\/03\/Linux_Backup_with_TAR_and_Cron Jobs.mp4&#8243; width=&#8221;100%&#8221;]<\/p>\n<p><strong>Level:<\/strong> Intermediate<br \/>\n<strong>Length of Class:<\/strong> 35 Minutes<\/p>\n<p><strong>Backup commands<\/strong><br \/>\n# sudo tar -cvpzf backupnamedate.tar.gz &#8211;exclude=\/mnt \/<\/p>\n<p><strong>Recovery commands (Create \/recover directory first)<\/strong><br \/>\nsudo tar -xvpzf backupnamedate.tar.gz -C \/recover<\/p>\n<p><strong>Introduction to Linux<\/strong><br \/>\nInstalling Linux<br \/>\nBasic Linux Tasks<br \/>\nVIM for File Editing<br \/>\nNavigation in Linux<br \/>\nUsers, Groups and Permissions in Linux<br \/>\nPurpose of Class<\/p>\n<p>This class teaches students how to backup directories using TAR, and demonstrates how to schedule tasks using Cron Jobs.<\/p>\n<p><strong>Topics Covered<\/strong><br \/>\nBacking Up Directories with TAR<br \/>\nRecovering Directories with TAR<br \/>\nSetting Up Cron Jobs for Scheduled Tasks<br \/>\nClass Notes<\/p>\n<p><strong>Backup Using TAR<\/strong><br \/>\nBackup = sudo tar &#8211;cvpzf backup.taz.gz &#8211;exclude\/=directory (recursive) PATH<br \/>\n&#8211;c = create new file (overwrites old file)<br \/>\n&#8211;v = verbose<br \/>\n&#8211;p = preserve permissions<br \/>\n&#8211;z = compress<br \/>\n&#8211;f = filename (very important)<br \/>\n&#8211;exclude=DIRCECTORY is Recursive<br \/>\nNaming Files with time = filename-$(date +%F-%T)<br \/>\nRecover Files from a TAR File<br \/>\nRecover = sudo tar &#8211;xvpzf FILE &#8211;C \/DIRECTORY<br \/>\nCapital -C = change to directory<br \/>\n-x = extract<\/p>\n<p><strong>Cron Jobs<\/strong><br \/>\nTo Edit the Crontab File = sudo cron &#8211;e (first time it will ask you your default editor)<br \/>\nFormat = minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command<br \/>\n* Wildcard for Every Minute\/Day\/Hour\/Month?Day of Week<br \/>\nExample to Backup Entire Server for 1am Every Morning = 0 1 * * * sudo tar -cvpzf \/backup.tar.gz &#8211;exclude=\/mnt \/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[flowplayer src=&#8221;https:\/\/easy-admin.ca\/my_uploads\/2016\/03\/Linux_Backup_with_TAR_and_Cron Jobs.mp4&#8243; width=&#8221;100%&#8221;] Level: Intermediate Length of Class: 35 Minutes Backup commands # sudo tar -cvpzf backupnamedate.tar.gz &#8211;exclude=\/mnt \/ Recovery commands (Create \/recover directory first) sudo tar -xvpzf backupnamedate.tar.gz -C \/recover Introduction to Linux Installing Linux Basic Linux Tasks VIM for File Editing Navigation in Linux Users, Groups and Permissions in Linux Purpose of &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2016\/03\/06\/linux-backup-with-tar-and-cron-jobs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Linux Backup with TAR and Cron<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}