{"id":273,"date":"2019-01-14T20:20:54","date_gmt":"2019-01-14T20:20:54","guid":{"rendered":"https:\/\/unsrewiki.1sys1.com\/?p=273"},"modified":"2019-04-30T17:03:58","modified_gmt":"2019-04-30T17:03:58","slug":"linux-server-backups-using-hidrive-pro","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2019\/01\/14\/linux-server-backups-using-hidrive-pro\/","title":{"rendered":"Linux Server Backups using HiDrive Pro"},"content":{"rendered":"\n<p>In this guide we will configure a nightly server backup running Bitnami with HiDrive Pro for FTP storage. <\/p>\n\n\n\n<p>Please note that only HiDrive Pro supports FTP access. Lower tariffs will not work with this setup: https:\/\/www.ionos.com\/office-solutions\/hidrive-cloud-storage<\/p>\n\n\n\n<p>Before we get started login to your HiDrive Pro account at https:\/\/hidrive.ionos.com <\/p>\n\n\n\n<p>Go to Settings &gt; Account. Under &#8220;Access rights and protocols&#8221; click the edit button and uncheck the &#8220;Only use encrypted connections&#8221; button.<\/p>\n\n\n\n<p>Now firstly you will want to login to your server using SSH and create the following folders: \/scripts and \/tmpbackup<\/p>\n\n\n\n<p>Now proceed with the steps below:<\/p>\n\n\n\n<p>First create \/scripts\/backup.sh with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/bitnami\/ctlscript.sh stop\n\/bin\/zip -r \/backup\/$(date +\\%Y-\\%m-\\%d).zip \/opt\/bitnami\n\/opt\/bitnami\/ctlscript.sh start<\/code><\/pre>\n\n\n\n<p>This code will stop your web services and then create and store a backup with today&#8217;s date in \/backup. It is best to stop web services while this is taken to ensure no data is lost. Since Bitnami is self-contained the entire \/opt\/bitnami folder is backed up. These folders can be adjusted accordingly if your data is stored elsewhere.<\/p>\n\n\n\n<p>Next create your 2nd script at \/scripts\/ftp.sh with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh<br> SERVER=\"ftp.hidrive.ionos.com\"<br> USERNAME=\"YourHiDriveUsername\"<br> PASSWORD=\"YourPassword\"<br> BACKUPDIRECTORY=\"\/users\/YourHiDriveUsername\/\"<br> cd \/backup<br> ftp -n -i $SERVER &lt;&lt;EOF<br> user $USERNAME $PASSWORD<br> passive<br> cd $BACKUPDIRCTORY <br> mput *.zip<br> quit<br> EOF<br> cd \/backup<br> rm -rf *.zip<\/pre>\n\n\n\n<p>This code connects to your ftp storage on HiDrive and transfers the backup previously run. Once the transfer completes it then deletes the backup from your server&#8217;s local storage.<\/p>\n\n\n\n<p>Next make sure to give needed execute privileges to your new scripts:<\/p>\n\n\n\n<p>chmod +x \/myscripts\/*<\/p>\n\n\n\n<p>To complete the automated backup process we will now configure a cronjob for each script:<\/p>\n\n\n\n<p>crontab -e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>0 2 * * * \/myscripts\/backup.sh\n0 3 * * * \/myscripts\/ftp.sh<\/code><\/pre>\n\n\n\n<p>This will have each script run daily at 2am and 3am. A delay is put in for the ftp transfer to ensure the previous archive process completes before the transfer starts. This is more of a personal preference as this could be combined into a single script. I prefer it this way as to spread out the load on the server as backup.sh will stress the CPU and Disk I\/O while ftp.sh will cause load on the Network.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide we will configure a nightly server backup running Bitnami with HiDrive Pro for FTP storage. Please note that only HiDrive Pro supports FTP access. Lower tariffs will not work with this setup: https:\/\/www.ionos.com\/office-solutions\/hidrive-cloud-storage Before we get started login to your HiDrive Pro account at https:\/\/hidrive.ionos.com Go to Settings &gt; Account. Under &#8220;Access&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7,1],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/273"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":9,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/273\/revisions\/348"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}