Handling Unsolicited Media Changes

A good system administrator always implements backup procedures, which protect her machines from damaged disks, malevolent miscreants, or rash <Return>s. The venerable tape is still the backup medium of choice for most shops due to its low cost and high reliability. Typically, a full system backup is performed, say, once a week, followed by periodic incremental change dumps. It’s not uncommon for a full dump to require several tape volumes, and some sort of operator intervention is required to swap tapes.

But our administrator, in accordance with Perl’s First Virtue, Laziness, is also likely to initiate these backups via cron or some similar automated means, which means there is no terminal for the backup program to communicate with her. Fortunately, the backup program has an option to run a user-specified program when a media change is required. This alert program is typically a script to send a mail message or display a window that attracts the operator’s attention. Sending mail seems to lack style. But opening a window is cool unless there are many machines, each with its own window, so let’s write a TCP/IP server that displays media change messages in Tk windows on a single machine, as they arrive from any number of backup client machines.

The Media Change Client, mediachangec

When the system backup reaches end of volume, it executes this incredibly simple client code, specifying the IP address of the media change server plus a message ...

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.