I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup, creator of the C++ programming language
I’ve been doing software development for twenty-five years as a hobby, and the last nine commercially as well. So when I ran into a problem that could be easily fixed by software, but couldn’t find any existing software that would do it properly, my first instinct was to dive for a compiler. But as I’d never done any software for Linux before, it was going to take some time to get up to speed on my target OS first.
The problem is easily stated: I’m using the Simple Backup package to create daily backups of my main system (now running Linux full-time) on my server (running Windows and Cygwin) over SSH. When it worked, it worked like a dream. When it didn’t, as was the case off and on for the first few weeks for various reasons, there was no warning of the failure. There was no way to tell that anything went wrong except to log into the server and look at the backup directory.
My planned solution involved writing a program that did just that. I’m sure there are better ways to do it (and once I find them, I’ll implement them), but for my first crude attempt, I intended to call the ssh program with a command line that simply requested a listing of the proper directory, then parse the names of the subdirectories. Since the subdirectory names created by Simple Backup contain the date and time that they were started, that should be sufficient — the program could just parse those to see how old the most recent one was, and if it was more than twenty-four hours old (or if it couldn’t retrieve it in the first place), it would throw up a warning flag that I couldn’t miss.
My preferred programming language is C++. Python might be a better choice for this (primarily because Simple Backup is written in that language, and would have most of the code for doing what I was trying to do already, but I decided to do it in C++ first, purely for the fun of it.
After compiling the Boost library for Linux (I already had it for Windows), and successfully building and running my first Linux test program (the subject-line-extraction program from the Boost library’s build page), I started looking for a decent Linux programming reference.
I found two. The first is the official GNU C Library documentation, which can be found in multiple formats here. The second is the more in-depth Advanced Linux Programming manual, with examples. I ignored the second for now, since I wasn’t ready for anything “advanced” yet.
Next up is an editor or IDE. I’ve started learning vi (because it’s one of the editors that’s available practically anywhere), but for any large project it isn’t near the top of my preferred-editors list. I’m not looking at emacs until I’ve learned enough of vi. However, I’ve heard good things about Eclipse, so I decided to give it a try.
After installing the eclipse
and eclipse-cdt
packages, refreshing my memory on how to write makefiles, and poking around for a while to get used to the new IDE, I managed to compile and run a program. Now the interesting part begins: writing code for my monitor program. That will be part of the next installment.