]> arthur.barton.de Git - backup-script.git/blob - bin/backup-script-wrapper
backup-script-wrapper: Use "mktemp" to generate temporary file
[backup-script.git] / bin / backup-script-wrapper
1 #!/bin/sh
2 #
3 # backup-script system for cloning systems using rsync
4 # Copyright (c)2008-2014 Alexander Barton, alex@barton.de
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
11 #
12
13 [ -n "$MAILTO" ] || MAILTO="logcheck"
14
15 NAME="backup-script"
16 HOST=`hostname`
17 TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11
18
19 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
20 export PATH
21
22 echo "$NAME Report" >$TMP
23 echo >>$TMP
24 echo " - Host: `hostname -f`" >>$TMP
25 echo " - User: `id -un`" >>$TMP
26 echo >>$TMP
27
28 `dirname "$0"`/backup-script $* >>$TMP 2>&1
29
30 cat $TMP | mail -s "$HOST: $NAME results" "$MAILTO"
31
32 rm -f $TMP
33
34 # -eof-