[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Email output + logging too?
From: |
Sharon Kimble |
Subject: |
[Help-bash] Email output + logging too? |
Date: |
Sat, 14 Sep 2013 09:15:58 +0100 |
I have this script which uses obnam to back up my /home/$USER
directory, and it outputs to 2 logs, and should also output to an
email.
=======================================
LOGFILE="/home/boudiccas/logs/obnam.txt"
LOGGING2="/home/boudiccas/cron/du.txt"
####################################################
notify-send "Starting main backup..."
obnam backup
if [ "$?" -ne 0 ]; then
notify-send "Unable to finish main backup."
exit 1
else
notify-send "Finished main backup."
du -sh /media/boudiccas/backup/obnam-home>>$LOGGING2 2>&1
echo 'Sending Backup report : Backup of obnam-home completed', $(date
-R) 'logged to'>>$LOGFILE 2>&1
fi
==============================================
As shown it just outputs to the logs but not the email.
Whereas
====================================================
LOGFILE="/home/boudiccas/logs/obnam.txt"
LOGGING2="/home/boudiccas/cron/du.txt"
####################################################
notify-send "Starting main backup..."
obnam backup
if [ "$?" -ne 0 ]; then
notify-send "Unable to finish main backup."
exit 1
else
notify-send "Finished main backup."
du -sh /media/boudiccas/backup/obnam-home; $LOGGING2
echo 'Sending Backup report : Backup of obnam-home completed', $(date
-R) 'logged to' $LOGFILE
fi
==================================================
This version outputs to the email but not to the log.
===================================================
Backed up 12184 files (of 155678 found), uploaded 807.5 MiB in 14m23s
at 958.6 KiB/s average speed
488G /media/boudiccas/backup/obnam-home
Sending Backup report : Backup of obnam-home completed, Fri, 13 Sep
2013 12:15:38 +0100 logged to /home/boudiccas/logs/obnam.txt
========================================================
This is the expected email output.
What I'm looking for is to output to both the log and the email too,
but how please?
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.0.4
Registered Linux user 334501
signature.asc
Description: PGP signature
- [Help-bash] Email output + logging too?,
Sharon Kimble <=