Commit 9fd07b3c authored by Simone Piccardi's avatar Simone Piccardi
Browse files

Ancora sulla stampa dei messaggi interattivi

parent 0cf7da67
......@@ -54,7 +54,8 @@ ERRLOG=/tmp/fuss-backup-err.log
MESS="Data dump on $(hostname) for $(date +%x)"
# all output go to TMPLOG
exec 6<&1
exec 6>&1
exec 7>&2
exec > $TMPLOG 2>&1
# define exit function (sending email)
......@@ -75,6 +76,7 @@ mail_exit () {
done
else
exec 1<&6 6<&-
exec 2<&6 7<&-
cat $TMPLOG
fi
exit $1
......@@ -161,11 +163,9 @@ if [ "$COMMAND" ]; then
if mount $DISK $BASEDIR; then
[ -d $RECOVERDIR ] || mkdir -p $RECOVERDIR
borg mount $DESTINATION $RECOVERDIR
cat $TMPLOG
echo "mounted backup on $RECOVERDIR"
RETURN=0
else
cat $TMPLOG
echo "cannot mount repository"
RETURN=6
fi
......@@ -174,16 +174,14 @@ if [ "$COMMAND" ]; then
fusermount -u $RECOVERDIR
sleep 1
umount $BASEDIR
cat $TMPLOG
echo "backup recover umounted"
RETURN=0
;;
*)
echo "unknown command $COMMAND"
cat $TMPLOG
usage
;;
RETURN=5
;;
esac
mail_exit $RETURN
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment