]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script-wrapper
Correctly count the number of available generations
[backup-script.git] / bin / backup-script-wrapper
index d069670bde80aa0dc253a37d8bc0b42618bcbdcd..1b2d4495858fda370ffba41a99c3aac0df3e1aef 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # backup-script system for cloning systems using rsync
-# Copyright (c)2008-2013 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2014 Alexander Barton, alex@barton.de
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 NAME="backup-script"
 HOST=`hostname`
-TMP="/tmp/$NAME.$$"
+TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11
 
 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 export PATH
 
-echo "$NAME Report" >$TMP
-echo >>$TMP
-echo " - Host: `hostname -f`" >>$TMP
-echo " - User: `id -un`" >>$TMP
-echo >>$TMP
+echo "$NAME Report" >"$TMP"
+echo >>"$TMP"
+echo " - Host: `hostname -f`" >>"$TMP"
+echo " - User: `id -un`" >>"$TMP"
+echo >>"$TMP"
 
-`dirname "$0"`/backup-script $* >>$TMP 2>&1
+`dirname "$0"`/backup-script $* >>"$TMP" 2>&1
 
-cat $TMP | mail -s "$HOST: $NAME results" "$MAILTO"
+cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"
 
-rm -f $TMP
+rm -f "$TMP"
 
 # -eof-