Epoch History System (Fedora 23+)

November 23  2015 @ 10:34 EST

Since first installing and configuring Fedora 23,  I have spent much time on a retro activity of completing my earlier “BASEL” Bash Application for System Epoch Logging.  This is a lowest level hardest to maintain system based on a complex bash shell program, “mark-epoch-of” that maintains my history file.  I started this shell program in the era of Fedora 14.  I have evolved it considerably since first thinking it up.  Much of my time since installing Fedora 23 was spent recovering off line files, configuring applications, and ultimately over the past few days kluging a band-aid temporary version of my earlier BASEL system.

For Fedora 23, as I get my existing BASEL system limping along,  my immediate goal is replacing BASEL’s “mark-epoch-of” shell script with a new, slightly higher level language Perl Epoch History  Logging System version.   This will use my Perl approach to adding lines to my simple text file of event epoch  history.  My ultimate goal is a “mark-epoch-of.pl” program,  which like the earlier BASH version takes two arguments:  a code letter and a file name for recording the current event epoch record.  The file name is for a transient file with one event epoch record.  The event epoch record consists of the epoch code,  current user name, and date/time  information for the event (usually the time when mark-epoch-of.pl is executed.)

My first urge is to try to report a true “bootstrap” time from the “@reboot” Linux command executed from my “crontab” file installed.   My /home/LL/CH-Thorcboot bash shell executed by crontab’s “@reboot” line starts by reporting the output of the  date command to the file /home/LL/H/date-of-boot .   This is a transient file which I can use later when I log in and my Cinnamon startup program (current legacy name) BASEL-at-login.pl .   This Perl program retroactively enters the epoch event records of halt then boot in /home/LL/H/.istory.

I have found that the time I get from this cron based method is a tenth of a second or so later than the time recorded by the system in its log files accessed through the last -Fx command.  For bootstrap and shutdown (halt) events I thus use times I get from the Linux “last” shell command in most cases.   But there is a sporadic gotcha,  a fly in the ointment that did not start with Fedora 23:  The halt then boot times for a given day sometimes get lost in the shutdown/reboot process — even if there was no system crash at the time of shutdown.   Thus if the date is wrong (a day earlier usually) in the last -Fx output for shutdown and reboot,  I use the bootstrap time from my date-of-boot ultimately determined somewhat later in the boot process when cron is initialized.

Since there is no “shutdown” hook that I know of in the Cinnamon GUI,   I get my system shutdown time from the last -Fx command  output.

For consistency with my own stylistic perogatives,  I reformat all date outputs and other times from the last command.  In reporting historical and current events,  I repack date and time files in my own preferred form. The format I use in my history file for dates is as in this arbitrary example:

Mon Nov 23 2015 @ 06:04:12 EST

I like making the date complete (i.e. day of week, month, day of month, year)  using the “ @ ” symbol to separate it from the 8 digit time field, followed by 3 digit time zone.

I will used mark-epoch-of.pl to record  various daily epochs and other epochs as times coded with single character  codes in a short [one line] of my log .  Witfileh near certainty, every day there is the morning bootstrap (B), followed by a login (L) somewhat later in time.  At the end of the day, usually just before bed, there is an ultimate daily epoch of system alt (H) sometimes referred to as the “shutdown.   During the day their may be other random events coded with different letters in my customary usage. I will eventually present my current table of event codes on my site.

The Epoch History System keeps a latest-event-first serial log of events in my “History” file.   As before I will keep all the files of the Perl Epoch History Logging system [Perl programs,  a small set of BASH shells invoking my Perl “.pl” programs, my “.pl” Perl programs, log files, current login user name, etc ] in my own special tree of files, “/home/LL” (short for Local Logs) I chose this tree in order to keep my history system separate from any other file tree of Linux,  with a path that can be literally and redundantly noted in a small number of characters.  This to minimizes lengths of BASH shell lines in spite of explicit notation.

I can reach these files and programs by the 9 character absolute path “/home/LL/”.  One could certainly argue that a better choice would be to use of the Linux “current” directory mechanism and conventions.  But I am a very literal minded person, so in crucial development contexts like this I like seeing all path assumptions explicitly and redundantly noted rather than relying on “current directory” assumptions which may actually be far different from what I actually see (and remember.)  This eliminates many confusions.

The directory /home/LL/H/ is my place for PEHL system’s actual data.  This is principally the “/home/LL/H/istory” history file.  …/H/.istory is a simple text file containing one line recorded for each “event epoch” of system history.  I record the latest event at the top of the file,  so that a simple sequential read (whether BASH or Perl or any other language) of the first  N lines shows the latest history of my system.

Time for lunch! End of session, November 23, 2015 @ 13:08 EST