#!/usr/bin/env bash # adapt to your needs # this serves as an example and assumes configured mailx SNAPSHOTS=$(/usr/bin/restic snapshots -c) STATS=$(/usr/bin/restic stats) # output for stdin (service) echo -e "$STATS\n\n$SNAPSHOTS" # output for mail me="$0" echo -e "$STATS\n\n$SNAPSHOTS" | mailx -Ssendwait -s "[restic - $(hostname)] $me - REPORT" "${RESTIC_REPORT_MAIL}"