#!/usr/bin/env bash # Author: Lilian BESSON # Email: Lilian.BESSON[AT]ens-cachan[DOT]fr # Web version: http://perso.crans.org/besson/bin/GenerateStatsMarkdown.sh # Web version (2): https://bitbucket.org/lbesson/bin/src/master/GenerateStatsMarkdown.sh # Date: 28-03-2013 # # A small script to create a minimalistic Markdown status page for my machine, # available with zamok proxying at http://perso.crans.org/besson/stats.html (private ONLY) # or locally at http://127.0.0.1/stats.html # # Hack: this markdown page is using http://strapdownjs.com to be a good-looking HTML page ! # # NOTE: ssh.dptinfo.ens-cachan.fr version # # FIXME: zamok proxying not yet available # BIN=GenerateStatsMarkdown version=1.0 # StrapDownJS nice themes : cyborg united theme="${2:-united}" ## dest="${HOME}/Public/stats.html" dest="${HOME}/www/dl/stats.html" # Argument handling case "$1" in amelia|cerulean|cosmo|custom|cyborg|darkly|flatly|journal|lumen|readable|shamrock|simplex|slate|spacelab|spruce|superhero|united|yeti) echo -e "${red}Using $1 as a theme option...${white}" theme="$1" shift ;; -h|--help) echo -e "${green}${BIN}${white} --help | [options]\n Creates a minimalistic statistics HTML report, to ${dest}.\n It uses StrapDownJS to improve the awesomeness of this mini munin clone." echo -e "\nOptions:\n 1:\t${yellow}--help${white}\tto print this help,\n 1:\t${yellow}cron${white}\tto change logging behaviour (only if launched by cron),\n 1,2:\t${yellow}theme${white}\tin the list 'amelia', 'cerulean', 'cosmo', 'custom', 'cyborg', 'darkly', 'flatly', 'journal', 'lumen', 'readable', 'shamrock', 'simplex', 'slate', 'spacelab', 'spruce', 'superhero', 'united', 'yeti' (${cyan}Default and best is 'united', 'cyborg' is cool too${white}.)\n\n" echo -e "$BIN v$version : Copyrights: (c) Lilian Besson 2014.\nReleased under the term of the GPL v3 Licence (more details on http://perso.crans.org/besson/LICENSE.html).\nIn particular, $BIN is provided WITHOUT ANY WARANTY." exit 0 ;; *) ;; esac echo -e "${yellow}.: Lilian Besson presents :." echo -e "${cyan}${BIN}, v${version}${reset}" theme="${theme:-united}" echo -e "${cyan}The report will be written to : ${dest}${white}, with the theme ${magenta}${theme}${white}." if [ -f "$dest" ]; then cp -vf "$dest" /tmp/ fi # Header echo -e "