deblan-report/report

55 lignes
991 B
Bash
Fichiers exécutables

#!/bin/sh
# export EMAIL_RECIPIENT=you@example.com
# export EMAIL_SENDER=system@example.com
# export EMAIL_SUBJECT="[$(hostname)] Rapport journalier"
# export HTML_OUTPUT=/tmp/report.html
# export MUNIN_DIRECTORY=/var/cache/munin/www/localhost/localhost
# export SMART_DEVICES="/dev/sda /dev/sdb /dev/sdc"
# export LOGO_URL=
# -> default is: https://upload.deblan.org/u/2019-05/5cefbc0a.png
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export SCRIPT_NAME="$(realpath "$0")"
export SCRIPT_PATH="$(dirname "$SCRIPT_NAME")"
if [ -z "$TEMPLATE" ]; then
export TEMPLATE="$SCRIPT_PATH/templates/deblan"
fi
cd "$SCRIPT_PATH"
export ULIMIT=$(ulimit -s)
./hooks/on-start
REPORT="$(
./scripts/header
./scripts/system
./scripts/mount
./scripts/df
if [ -n "$SMART_DEVICES" ]; then
./scripts/smart
fi
./scripts/footer
)"
if [ -n "$HTML_OUTPUT" ]; then
export REPORT
./generators/html
fi
if [ -n "$EMAIL_RECIPIENT" ]; then
export REPORT
./generators/email
fi
./hooks/on-finish