{"id":118,"date":"2009-10-08T10:10:04","date_gmt":"2009-10-08T09:10:04","guid":{"rendered":"http:\/\/muratyaman.co.uk\/wp\/?p=118"},"modified":"2020-04-01T12:42:32","modified_gmt":"2020-04-01T11:42:32","slug":"tape-backup-on-centos","status":"publish","type":"post","link":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/2009\/10\/tape-backup-on-centos\/","title":{"rendered":"Tape backup on CentOS"},"content":{"rendered":"<p>On this occasion, we have a PHP\/Firebird application. We had to backup the database and the code (which includes PHP, HTML, CSS, Javascript files as well as user documents uploaded into a folder).<\/p>\n<p>We have created a folder <strong>\/mybackup\/<\/strong> and created a bash script <strong>backup.sh<\/strong> to do the following, using <a href=\"http:\/\/www.nano-editor.org\/\">nano<\/a> command line editor. We will always have 2 compressed gz files, remove the old ones. Backup the database, compress it. Backup the code folder, compress it. Rewind the tape. Then, copy into the tape. We are expecting the client to eject the tape and insert another one everyday, Monday to Friday.<\/p>\n<pre lang=\"bash\">\r\n#!\/bin\/bash\r\nrm -f *.gz\r\n\/opt\/firebird\/bin\/gbak -t -user sysdba -password \"mypassword\" localhost:mydb \/mybackup\/mydb.fbk\r\ngzip mydb.fbk\r\ntar -cpf mycode.tar \/var\/www\/html\r\ngzip mycode.tar\r\nmt -f \/dev\/st0 rewind\r\ntar -cpf \/dev\/st0 *.gz\r\n<\/pre>\n<p>(<strong>mydb<\/strong> is an alias pointing to a FDB database file defined in <a href=\"http:\/\/firebirdsql.org\/pdfmanual\/Link-to-HTML-manual\/fbutils-scripts-db-alias.html\">Firebird aliases.conf<\/a>)<\/p>\n<p>Using <a href=\"http:\/\/www.webmin.com\/\">Webmin<\/a>, my favourite online system administration tool for Linux, I&#8217;ve created a cron job to run <strong>\/mybackup\/backup.sh<\/strong> at required intervals.<\/p>\n<p>Make sure that the user account that runs the commands has the execute and write permissions where needed.<\/p>\n<p>Install <strong>mt<\/strong>, if your system has not got it already.<\/p>\n<figure id=\"attachment_119\" aria-describedby=\"caption-attachment-119\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/muratyaman.co.uk\/wp\/wp-content\/uploads\/2009\/10\/centos-package-manager.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/muratyaman.co.uk\/wp\/wp-content\/uploads\/2009\/10\/centos-package-manager-300x241.jpg\" alt=\"CentOS package manager\" title=\"CentOS package manager\" width=\"300\" height=\"241\" class=\"size-medium wp-image-119\" srcset=\"https:\/\/www.muratyaman.co.uk\/blog\/wp-content\/uploads\/2009\/10\/centos-package-manager-300x241.jpg 300w, https:\/\/www.muratyaman.co.uk\/blog\/wp-content\/uploads\/2009\/10\/centos-package-manager.jpg 806w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-119\" class=\"wp-caption-text\">CentOS package manager<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>On this occasion, we have a PHP\/Firebird application.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[72,55,126,33],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-technology","tag-backup","tag-firebird","tag-linux","tag-sql"],"_links":{"self":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":6,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":956,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions\/956"}],"wp:attachment":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}