Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

Report


#!/bin/bash
# Filename: report.sh
# Version: 170816
# Author: robz
# Report for newPVR.sh activity, HTML page served by nginx.
# Root crontab
# Update index.html page.
# @reboot /home/pi/Downloads/scripts/report.sh > /dev/null 2>&1
# Kill server.
# 00 18 * * * sudo /etc/init.d/nginx stop

boot="$(date -d "@"$(awk '/btime/{print $2}' /proc/stat) +"%H:%M:%S")"
stor="$(df -h / | awk 'NR==2 {print $5}')"
lst1="$(cat "/home/pi/Downloads/log/motd.txt")"
lst2="/home/pi/Downloads/scripts/followed-shows.txt"
lst2="$(grep -v '^$\|^\s*\#' "$lst2" | nl -w3 -s ')  ')"

cat > /usr/share/nginx/www/index.html << EOF
<!DOCTYPE html>
<html>
<head>
  <title>robz Report</title>
  <style>
    html {
      background: url(pi.jpg) no-repeat center center fixed;
      background-size: cover;
      -webkit-background-size: cover;
      -o-background-size: cover;
    }
    h1 {
      color: #BD1143; text-shadow: 2px 2px 1px #FFFFFF;
      font-size: 40px; font-style: italic;
    }
    h3 {
      font-style: italic; font-weight: 600;
      margin: 0;
    }
    body {
      color: #FFFFFF;
      font-family: sans-serif; font-size: 12px; font-weight: 500;
      margin-left: 25px;
    }
    .footer {
      color: #BD1143;
      font-size: 8px; font-style: italic; font-weight: 700;
      position: fixed;
      bottom: 5px; right: 5px;
    }
  </style>
</head>
<body>
<h1>The <img src="pi5.png" align="top" width="34" height="42"> Pi Torrent Box...
</h1>
<pre>
<h3> Download report for $(date +%A" "%d" "%B)</h3>
 Machine last rebooted at $boot - SD card usage is currently at $stor
<br>$lst1
<br> Tracked shows.:
<br>$lst2
</pre>
<span class="footer">Raspberry powered page by robz</span>
</body>
</html>
EOF



No comments: