Status Checks

While working on and testing my Backup Solution, I made use of a simple conky script that displayed my ~/.conky/cryptshotr-corn/log on top of my desktop. This was a fairly simple conky, which I cribbed from my syslog/auth conky script. Due to the number of expected fails, like using my laptop while not at home, I taught cryptshotr to clear old 'PERIODICITY failed' lines on pass. This worked well enough.

2016-01-01 19:00:00     yearly  passed  1451606400     ## Mock entry, hasn't been a year yet ^_-
2016-06-05 21:34:06     monthly passed  1465176846
2016-06-26 18:56:04     weekly  passed  1466981764
2016-07-01 10:25:27     daily   passed  1467383127
2016-07-01 11:20:19     hourly  passed  1467386419
2016-07-01 14:00:01     hourly  FAILED  1467396001
2016-07-01 14:30:01     hourly  FAILED  1467397801
2016-07-01 15:00:01     hourly  FAILED  1467399601
2016-07-01 15:30:01     hourly  FAILED  1467401401
2016-07-01 16:03:48     hourly  FAILED  1467403428
2016-07-01 18:00:01     hourly  FAILED  1467410401
2016-07-01 18:30:01     hourly  FAILED  1467412201

Extended Absence

A month or so after finishing cyrptshotr I was house sitting and away from my place from about two weeks. This generated a lot of expected fail messages... Every half hour PERIODICITIES that were due would attempt to run, and as time went on the number due increased; this was further compounded by being the end of the month (hourly, daily, weekly, monthly). As expected, that got a little bit annoying. Now yes, I could have taken the backup drive with me and directly connected it, and I may do this in the future. But that doesn't mean that the display can't be better.

What Could Be Better

Instead of displaying everything why not:

  • grab the last occurrence of PERIODICITY
  • see if it passed
  • display when it passed
    • or find the last time PERIODICITY passed
  • use a simple icon to show pass/fail

Awk a beautiful beast

awk '/PERIODICITY/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log

End Result

My back_log_backups.conkyrc:
cryptshotr conky

## Window settings
own_window yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes

## Compton doesn't like conky transparent, so this is the fix
## http://conky.pitstop.free.fr/wiki/index.php5?title=Transparency_in_conky_(en)
own_window_transparent no #yes
own_window_argb_visual yes
own_window_argb_value 0

## Window Size
minimum_width 1900
maximum_width 1920

# fiddle with window
use_spacer none
use_xft yes

## Update interval in seconds
update_interval 60.0

## Minimum size of text area
# minimum_size 250 5

## Draw shades?
draw_shades no

## Text stuff
draw_outline no # amplifies text if yes
draw_borders no
font PragmataPro:size=7
uppercase no


## Default colors and also border colors, grey90 == #e5e5e5
default_color grey

## Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

## Gap between borders of screen and text
## The default size is a bit large
gap_x 10
gap_y 10

## stuff after ‘TEXT’ will be formatted on screen
## This summarizes the backup pass/fail state.
## Written to display 'fail' if periodicity not in log, though will look odd.
## For some reason 'monthly' can't be regexed... though it worked before fixing fail state.
## As such, 'month' is intentional.
TEXT
$color
${color grey90}Backups ${hr 2}$color
Yearly ${alignr}${exec awk '/yearly/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log}
Monthly ${alignr}${exec awk '/month/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log}
Weekly ${alignr}${exec awk '/weekly/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log}
Daily ${alignr}${exec awk '/daily/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log}
Hourly ${alignr}${exec awk '/hourly/ {LL=$0;if($4=="passed"){LAST=$1 " " $2}} END {match(LL, /(.*)\s(.*)\t(\w+)\t(\w+)\t([0-9]+)/, m); if(m[4]=="passed"){printf "☑ passed %s %s\n", m[1], m[2]} else {printf "⚠ last passed %s\n", LAST}}' $HOME/.config/cryptshotr-cron/log}

Backup Solution
conky
cryptshotr
back_log_backups.conkyrc

- demure