{"id":892,"date":"2015-11-23T13:09:52","date_gmt":"2015-11-23T18:09:52","guid":{"rendered":"http:\/\/www.helmers.com\/?p=892"},"modified":"2016-04-05T12:12:39","modified_gmt":"2016-04-05T16:12:39","slug":"epoch-history-system-fedora-23","status":"publish","type":"post","link":"http:\/\/www.helmers.com\/?p=892","title":{"rendered":"Epoch History System (Fedora 23+)"},"content":{"rendered":"<p><strong>November 23\u00a0 2015 @ 10:34 EST<\/strong><\/p>\n<p>Since first installing and configuring Fedora 23,\u00a0 I have spent much time on a retro activity of completing my earlier &#8220;BASEL&#8221; <strong>B<\/strong>ash <strong>A<\/strong>pplication for <strong>S<\/strong>ystem <strong>E<\/strong>poch <strong>L<\/strong>ogging.\u00a0 This is a lowest level hardest to maintain system based on a complex bash shell program, &#8220;mark-epoch-of&#8221; that maintains my history file.\u00a0 I started this shell program in the era of Fedora 14.\u00a0 I have evolved it considerably since first thinking it up.\u00a0 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.<\/p>\n<p>For Fedora 23, as I get my existing BASEL system limping along,\u00a0 my immediate goal is replacing BASEL&#8217;s &#8220;mark-epoch-of&#8221; shell script with a new, slightly higher level language Perl Epoch History\u00a0 Logging System version.\u00a0\u00a0 This will use my Perl approach to adding lines to my simple text file of event epoch\u00a0 history.\u00a0 My ultimate goal is a &#8220;mark-epoch-of.pl&#8221; program,\u00a0 which like the earlier BASH version takes two arguments:\u00a0 a code letter and a file name for recording the current event epoch record.\u00a0 The file name is for a transient file with one event epoch record.\u00a0 The event epoch record consists of the epoch code,\u00a0 current user name, and date\/time\u00a0 information for the event (usually the time when <strong>mark-epoch-of.pl<\/strong> is executed.)<\/p>\n<p>My first urge is to try to report a true &#8220;bootstrap&#8221; time from the &#8220;@reboot&#8221; Linux command executed from my &#8220;crontab&#8221; file installed. \u00a0 My<strong> \/home\/LL\/CH-Thorcboot<\/strong> bash shell executed by crontab&#8217;s &#8220;@reboot&#8221; line starts by reporting the output of the\u00a0 <strong>date<\/strong> command to the file\u00a0<strong>\/home\/LL\/H\/date-of-boot<\/strong> . \u00a0 This is a transient file which I can use later when I log in and my Cinnamon startup program (current legacy name) <strong>BASEL-at-login.pl<\/strong> . \u00a0 This Perl program retroactively enters the epoch event records of halt then boot in <strong>\/home\/LL\/H\/.istory<\/strong>.<\/p>\n<p>I have found that the time I get from this <strong>cron<\/strong> 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 <strong>last -Fx<\/strong> command.\u00a0 For bootstrap and shutdown (halt) events I thus use times I get from the Linux &#8220;<strong>last<\/strong>&#8221; shell command in most cases.\u00a0\u00a0 But there is a sporadic gotcha,\u00a0 a fly in the ointment that did not start with Fedora 23:\u00a0 The halt then boot times for a given day sometimes get lost in the shutdown\/reboot process &#8212; even if there was no system crash at the time of shutdown. \u00a0 Thus if the date is wrong (a day earlier usually) in the <strong>last -Fx<\/strong> output for shutdown and reboot,\u00a0 I use the bootstrap time from my <strong>date-of-boot<\/strong> ultimately determined somewhat later in the boot process when <strong>cron<\/strong> is initialized.<\/p>\n<p>Since there is no &#8220;shutdown&#8221; hook that I know of in the Cinnamon GUI, \u00a0 I get my system shutdown time from the <strong>last -Fx<\/strong> command\u00a0 output.<\/p>\n<p style=\"text-align: left;\">For consistency with my own stylistic perogatives,\u00a0 I reformat all <strong>date<\/strong> outputs and other times from the <strong>last<\/strong> command.\u00a0 In reporting historical and current events,\u00a0 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:<\/p>\n<p style=\"text-align: center;\"><strong>Mon Nov 23 2015 <span style=\"color: #ff0000;\">@<\/span> 06:04:12 EST<\/strong><\/p>\n<p>I <span style=\"color: #ff0000;\"><em><strong>like<\/strong><\/em><\/span> making the date complete (i.e. day of week, month, day of month, year)\u00a0 using the &#8220;<span style=\"color: #ff0000;\"><strong> @<\/strong><\/span> &#8221; symbol to separate it from the 8 digit time field, followed by 3 digit time zone.<\/p>\n<p>I will used <strong>mark-epoch-of.pl <\/strong>to record\u00a0 various daily epochs and other epochs as times coded with single character\u00a0 codes in a short [one line] of my log .\u00a0 Witfileh near certainty, every day there is the morning bootstrap (<strong>B<\/strong>), followed by a login (<strong>L<\/strong>) somewhat later in time.\u00a0 At the end of the day, usually just before bed, there is an ultimate daily epoch of system alt (<strong>H<\/strong>) sometimes referred to as the &#8220;shutdown. \u00a0 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.<\/p>\n<p>The Epoch History System keeps a latest-event-first serial log of events in my &#8220;History&#8221; file.\u00a0\u00a0 As before I will keep all the files of the Perl Epoch History Logging system [Perl programs,\u00a0 a small set of BASH shells invoking my Perl &#8220;.pl&#8221; programs, my &#8220;.pl&#8221; Perl programs, log files, current login user name, etc ] in my own special tree of files, &#8220;\/home\/LL&#8221; (short for Local Logs) I chose this tree in order to keep my history system separate from any other file tree of Linux,\u00a0 with a path that can be literally and redundantly noted in a small number of characters.\u00a0 This to minimizes lengths of BASH shell lines in spite of explicit notation.<\/p>\n<p>I can reach these files and programs by the 9 character absolute path &#8220;\/home\/LL\/&#8221;.\u00a0 One could certainly argue that a better choice would be to use of the Linux &#8220;current&#8221; directory mechanism and conventions.\u00a0 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 &#8220;current directory&#8221; assumptions which may actually be far different from what I actually see (and remember.)\u00a0 This eliminates many confusions.<\/p>\n<p>The directory <strong>\/home\/LL\/H\/<\/strong> is my place for PEHL system&#8217;s actual data.\u00a0 This is principally the &#8220;<strong>\/home\/LL\/H\/istory<\/strong>&#8221; history file.\u00a0 &#8230;<strong>\/H\/.istory<\/strong> is a simple text file containing one line recorded for each &#8220;event epoch&#8221; of system history.\u00a0 I record the latest event at the top of the file,\u00a0 so that a simple sequential read (whether BASH or Perl or any other language) of the first\u00a0 N lines shows the latest history of my system.<\/p>\n<p>Time for lunch! End of session, November 23, 2015 @ 13:08 EST<\/p>\n","protected":false},"excerpt":{"rendered":"<p>November 23\u00a0 2015 @ 10:34 EST Since first installing and configuring Fedora 23,\u00a0 I have spent much time on a retro activity of completing my earlier &#8220;BASEL&#8221; Bash Application for System Epoch Logging.\u00a0 This is a lowest level hardest to maintain system based on a complex bash shell program, &#8220;mark-epoch-of&#8221; that maintains my history file.\u00a0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-892","post","type-post","status-publish","format-standard","hentry","category-perl-epoch-recording-logging-system"],"_links":{"self":[{"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/posts\/892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.helmers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=892"}],"version-history":[{"count":3,"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions"}],"predecessor-version":[{"id":933,"href":"http:\/\/www.helmers.com\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions\/933"}],"wp:attachment":[{"href":"http:\/\/www.helmers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.helmers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.helmers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}