CategoryBlog

Server Backups Using Git

At work, I’ve fallen in love with Git for our revision software. A co-worker told me that he uses Git to automatically backup his entire home directory on his computer, so I figured I could do something similar with the VPS that hosts this website.

There are two things required to make this work: Git, and a destination server to push your backup to.

The script I’m using is copied below (password redacted for security).

 #!/bin/bash 

MYSQLUSER="root" 
MYSQLPASS="MyF4k3p4sSw0rd" 
DATE=$(date +%Y-%m-%d) 

pushd ~/backup 
mysqldump -u $MYSQLUSER -p$MYSQLPASS --all-databases > mysql/alldb.sql
cp -r /var/www/* www/

git add .
git commit -s -m "$DATE"
git push origin master

popd 

All in all, pretty basic as far as things go. Dump the entire MySQL/MariaDB database, copy all the bare files from the /var/www directory, and then commit them to git. The other advantage of this is that it’s dead simple to restore a backup from any previous date. The nice advantage of using git is that it’s entirely OS agnostic, so I can restore the contents from one system to the other with minimal difficulties.

I remembered! Sort of….

So, continuing my challenge. I meant to post this up earlier (it’s technically Tuesday now), but I got distracted with other things.

In current news, my girlfriend and I are making a trip to Hawaii next week with a few friends. I’m really looking forward to getting away from the city for a while (not that I don’t love Vancouver) and finally getting my fins wet while scuba diving again. I might have to take a bit of a break on this whole ‘post every two days’ thing while I’m away, depending on internet availability. I’ll try to get something up and running though.

I’ve also been putting a bit of spare time into getting my Youtube channel a little more streamlined and putting a few more videos up on there in order to increase it’s popularity. Most of my videos are probably going to be related to World of Warcraft (I’m currently in a progression guild at the moment), but there will be some other videos as well. Zxian’s Youtube Channel.

Now it’s time for sleep.

I’m really terrible at this blogging thing….

So, I said in my previous post (which was nearly two years ago) that I was going to try to post more often. In following my girlfriend’s lead, I am posing myself a challenge. I must post at least once every two days. Even if it’s just something simple (like what I made for dinner), or something big and exciting. I’ve also started uploading quite a few videos of the games that I play, and I’m hoping to start recording a few guides on how I have my system and software setup.

For now, I leave you with a video of some kittens my friend is taking care of at the moment.

[video_lightbox_youtube video_id=”nIBB5rgtiUU” width=”640″ height=”480″ anchor=”Kittens”]

Server move complete!

If you’re seeing this (and the hideous default WordPress theme) then it means that the site is being hosted from its new home! Hooray!

EDIT – Yay! The old theme is back again. I’ve also improved the Hamachi status indicators to make the site faster. They’re now being pulled from a database which is updated by the server every 5 minutes. 🙂

Server Moves… again

Just so everyone is aware, there might be some downtime of this main frontpage in the near future. I’m in the process of moving my domain to my personal registrar, and the site itself to a VPS hosted by my friend jcarle (thanks!). I’m hoping the overall transition will be relatively smooth and there won’t be too many hiccups along the way.

© 2020 Zxian's Blog

Theme by Anders NorénUp ↑