-# This program is part of GNU tar
-# Copyright 2004, Free Software Foundation
-#
-# This program is free software; you can redistribute it and/or modify
+# Make backups.
+
+# Copyright 2004-2006, 2013 Free Software Foundation
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
-# the Free Software Foundation; either version 1, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-f, --force Force backup even if today's log file already
exists.
-v, --verbose[=LEVEL] Set verbosity level. Default 100.
-f, --force Force backup even if today's log file already
exists.
-v, --verbose[=LEVEL] Set verbosity level. Default 100.
-V, --version Display program version.
Optional argument WHEN is for backward compatibility only. It has been
-V, --version Display program version.
Optional argument WHEN is for backward compatibility only. It has been
if [ $DUMP_LEVEL -ne 0 ]; then
PREV_LEVEL=`expr $DUMP_LEVEL - 1`
PREV_DATE=`ls -t ${LOGPATH}/log-*-level-$PREV_LEVEL|
if [ $DUMP_LEVEL -ne 0 ]; then
PREV_LEVEL=`expr $DUMP_LEVEL - 1`
PREV_DATE=`ls -t ${LOGPATH}/log-*-level-$PREV_LEVEL|
sed "s,${LOGPATH}/log-\(.*\)-level.*,\1,"`
if [ "x$PREV_DATE" = x ]; then
bailout "Can't determine date of the previous backup"
sed "s,${LOGPATH}/log-\(.*\)-level.*,\1,"`
if [ "x$PREV_DATE" = x ]; then
bailout "Can't determine date of the previous backup"
message 20 "BACKUP_FILES=$BACKUP_FILES"
# The buch of commands below is run in a subshell for which all output is
message 20 "BACKUP_FILES=$BACKUP_FILES"
# The buch of commands below is run in a subshell for which all output is
# multiple pipelines all over the place, is cleaner and allows access to
# the exit value from various commands more easily.
(
# multiple pipelines all over the place, is cleaner and allows access to
# the exit value from various commands more easily.
(
fsname="`echo \"${1}\" | sed -e 's/\//:/g'`"
remotehost="`expr \"${1}\" : '\([^/][^/]*\):.*'`"
if [ -z "$remotehost" ]; then
remotehost=$localhost
fi
fsname="`echo \"${1}\" | sed -e 's/\//:/g'`"
remotehost="`expr \"${1}\" : '\([^/][^/]*\):.*'`"
if [ -z "$remotehost" ]; then
remotehost=$localhost
fi
- LF=`level_log_name ${fsname} 0`
- pdate=`remote_run "${remotehost}" ls -l $LF | awk '{
- printf("%s", $6)
- for (i=7;i<NF;i++)
- printf(" %s", $i)
- print "" }'`
- echo "Last `prev_level` dump on this filesystem was on $pdate"
- remote_run "${remotehost}" cp $LF "`level_log_name temp`"
+ echo "Last `prev_level` dump on this filesystem was on $PREV_DATE"
+ remote_run "${remotehost}" cp "`level_log_name ${fsname} $PREV_LEVEL`" "`level_log_name temp`"
${DUMP_BEGIN-:} $DUMP_LEVEL $remotehost $fs $fsname
backup_host ${remotehost} \
"--listed=`level_log_name temp`" \
"--label='`print_level` backup of ${fs} on ${remotehost} at ${NOW}'" \
-C ${fs} .
${DUMP_BEGIN-:} $DUMP_LEVEL $remotehost $fs $fsname
backup_host ${remotehost} \
"--listed=`level_log_name temp`" \
"--label='`print_level` backup of ${fs} on ${remotehost} at ${NOW}'" \
-C ${fs} .
- make_level_log $localhost
+ if [ $DUMP_LEVEL -eq 0 ]; then
+ make_level_log $localhost
+ else
+ echo "Last `prev_level` dump on this filesystem was on $PREV_DATE"
+ remote_run "${localhost}" cp "`level_log_name MISC $PREV_LEVEL`" "`level_log_name temp`"
+ fi
-echo "Sending the dump log to ${ADMINISTRATOR}"
-mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}"
+if test "${ADMINISTRATOR}" != NONE; then
+ echo "Sending the dump log to ${ADMINISTRATOR}"
+ mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}"
+fi