Long time no post. Well, life precludes various tech experimentation and hoped-for successes sometimes.
But I do have a couple of projects to describe. One involves a back-up routine I developed a few years ago. I have doubts that one will be of much interest to most in that it was developed specifically for the non-uefi machines I tend to use and target the paltry-sized hard drives (120 gb and less) and comparativeley meager installations I favor. But it's fairly straightforward and, to my somewhat unrefined tech sensibilities, clever. The other is yet simpler and is the one I'll be describing in this post.
I refer to it as a motd
(message of the day) project/routine because I want the system to provide me with certain information when I log in. My implementation differs a bit in that it also even provides this information whenever I start a new bash
session.
The information I want the system to provide me is twofold: 1) reminder of when I last backed up the system, and 2) on some of my machines, a reminder of when I last updated the operating system. In most cases what I'll need reminding about is only number 1), since I'm regularly using these systems and do operating system updates on these rolling-release (Arch and Void) systems every 1-2 weeks.
On other systems, however, such as my laptop, I'll need reminding about number 2) as well. That machine, and the VPS I use, are systems I am only occassionally logged into. So knowing when was the last operating system update is quite important on those.
So my solution involves creating the files motd-backup.txt
and motd-update.txt
in my home directory and writing target information to them. Since I haven't scripted the back-up routine, that has to be done manually by running something like echo "++last system back up done on $(date)++" >/home/user/motd-backup.txt
after I've finished running my back-up routine. That's something I'll be adding to the notes I keep as a reminder about how to use that routine.
As for the operating system updates, I've semi-automated those. I run a script at certain intervals that opens a bash session and queries whether I'd like to do a system update: a response in the positive triggers the update. I've added to that a command that runs after a successful update and writes information to ~/motd-update.txt
. It looks as follows: echo "++last update $(cat /var/log/pacman.log | tail -1 | cut -c2-11)++" >/home/user/motd-update.txt
Arch'ers will understand that what's happening is that the pacman log file is being queried and information from the final entry is being excerpted and cat
'ed (is this a misuse of cat
?) into the motd-update.txt
file. It has worked well in my testing and should suffice for the purpose.
The final piece of the puzzle is getting the information to display. I want it to be available during my day-to-day computer usage and not in a file stored somewhere on the system. Experience has indicated that I am likely to forget about such a file and so become remiss in my system administration responsibilites.
Since I'm regularly using a terminal, I decided a good place to cause that information to be auto-displayed with regularity would be make it part of the process of starting terminal sessions. So I put the following line at the end of my .bashrc
: cat ~/motd-update.txt && cat ~/motd-backup.txt
And that addressesd my issue. Every time I log into the system or start a new terminal, that information appears.
As I write this, I begin to think of alternatives. For example, I could use something like Xmessage
and cause a pop-up to appear at regular intervals--say once weekly--that would contain such information. I'm sure other options like zenity
could be fairly easily configured to do the same. Or perhaps making a .png
out of the information as I wrote about a few years ago (https://audaciousamateur.blogspot.com/2020/04/another-imagemagick-trick-txt-to-png.html) and using cron
to pop up feh
or some image-displaying utility that shows the information in bright text on a dark background. That could be more disruptive but might be more effective.
In any case, what are your ideas for displaying important information like that? Auto-generated e-mails, for example? There are lots of possibilities. The ways to skin this cat (pun intended) are numerous.
No comments:
Post a Comment