BMUS 0

November 20, 2018
Golang Backups Linux

BMUS ~ Back Me Up Scotty

Taking backups of devices is something that more often than not people don’t do, and this includes myself. Prior to my bachelor’s I never took backups or even thought about them. Looking back I reee internally everytime I think about how much I would have lost if something had happened to my laptops or desktops over the years. Don’t be like the 2015 me, take regular backups… Ever since a friend of mine, Nick got me into Linux I have been learning new things everyday, from built in commands, to the various things that can be done from the terminal.

One of the commands that I stumbled upon is called rsync. “Rsync is a utility for transferring and synchronizing files across computer systems”[~]. It was written by Andrew Tridgell and Paul Mackerras, back in 1996 (it’s as old as I am). It is now a standard Linux utility, and is included in most distributions. This is perfect since I prefer using the terminal over GUI applications now and it comes pre-installed on my OS of choice. Another plus of this is I can wrap the rsync command in a Golang program using os.exec. Thus Bmus was born…

Bmus, or Back Me Up Scotty, is the software that I developed so that I can get into the habit of taking regular backups without having the headache of proprietary software, or remembering to execute the backup process. The program at this current point is basic, it takes 3 flags; -f, -t, and -d. -f is to pass flag options for rsync. For example I use -azvh which breaks down to be; archive, z ~ compress, verbose, human readable.

One problem that I have noticed was having to hardcode the directory path of the rsync command when executing it. This is /home/oglinuk at the moment, but if anyone else were to use bmus, it would not work. Currently I am working on a solution involving either the built in command whoami or utilizing the standard Go library os. I have tried basic implementations of both, but have yet to find a working solution.

Update 8/25/2019

I have put off working more on bmus for quite a while, but have dedicated time and am actively developing it again. I’ve made a few changes and have gotten it to a working state.

To start I no longer use a hardcoded path, everything uses absolute paths. When I started making changes I originally made it so that you would create a config.json file which would store the flags, target, and destination. Then I decided to move that into a seperate development branch as the primary use case of this program will be via the command-line.

The next thing I changed was to use the absolute path for both the target and destination paths to avoid errors when using targets/destinations like . or ~.

I added a few things which include a check to ensure the target/destination exist, if a destination does not exist, one is created with the given path.

I also added an archival process, where the backup destination is compressed into a zip file.

Vim 1

April 25, 2020
Vim C Linux Open Source

Shell 2

April 20, 2020
Linux Shell Open Source

Shell 1

April 19, 2020
Linux Shell Open Source
comments powered by Disqus