
Backup Management System
Overview
Prior to this project, I managed backups on my home server with a series of commands which I’d set to run on a weekly basis. I thought that a more refined system could help me to easier see what backups I have, make adding and removing backups simpler, and give me the option to restore backups quickly should I need to. My main goal was to write a program which I would actually use for something instead of just something that I would see works and then never run again.
Analysis and Design
I used Python for this project since it’s easy to work with and fast performance is not an issue since backups would be made overnight when the system is not under load. I opted to use a JSON structure for holding the directories to be backed up from and to, which allowed for groups to be made, meaning that there could be more granular control over what parts of my file system are backed up at one time by specifying at runtime. To run the process of copying files I used a program called Rsync over the ‘cp’ command since it means that files which have not been changed since the previous backup will not be copied over, which would make my system less efficient overall and could wear down drives prematurely.
The design process was simple, all I did was write out everything the program needed to do, and then determined which functions could achieve this efficiently without code repetition.
mplementation and Testing
I started writing the program with the functions which would be required for it to run, saving putting together the parts for user interaction until the end. I tested the program on an ongoing basis, seeing that each function acted as expected after it was written. To aid with testing and further monitoring of the application, I implemented a log file system. I find that this development cycle allows for me to ensure that I have all of the parts of the program working as intended before putting it all together, allowing for a robust program to be constructed.
Challenges faced
I did make one critical error during the development process, this came after I’d finished writing the code and was testing out an install script that I’d made to easily get the program set up on my server and any other machines I might want it on. I messed up a directory path which ended up causing my binaries directory, which contains the pointers to all of the installed programs on my work machine, to be overwritten. This meant that I could only use the computer from the command line after that and I would have to reinstall everything to get it back how it was before. I instead took this opportunity to take the plunge with a new operating system I’d been experimenting with, FreeBSD, which is targeted more towards servers, putting it in line with the things I’m interested in learning about.
Evaluation
The development of this program was a complete success, I wrote a program which manages my backups, covering all of the bases I set out. My goal of writing software that would actually be used was met as I have the backup function of the program being run on a weekly basis on my server, keeping my files and system backed up should I mess something up. Had I used this on my laptop before making the mistake with the install script, I would’ve been able to completely restore the system right away. The inclusion of a log file will greatly help in identifying the source of any errors should issues arise in future.
Conclusion
My takeaways from this project were that I am capable of writing software which serves an actual purpose and makes something easier for me. I also learned that I should take extra care when dealing with important system paths in order to avoid critical failures such as when I overwrote my binaries directory.
One thing I would change about what I did is that I would consider writing this program as a shell script since that would push me a bit further from my comfort zone than Python and would help me with learning to program at a lower level. I intend to improve the program going forward by implementing some sort of notification system, such as automatically sending an email to let me know a backup has been successful or if there have been any issues. You can find a code listing of this project on my Github.