Also fix printing the full command line in the log.
do_prune() {
local num_snapshots="$1"
local suffix="$2"
- local oldest="$(ls -d [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$suffix | head -n -$num_snapshots)"
+ local oldest="$(ls 2>/dev/null -d [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$suffix | head -n -$num_snapshots)"
for old in $oldest; do
echo "$(date): Removing oldest snapshot(s): $old..."
rm -rf "$old" || exit 669
# make sure to be root
if (( `id -u` != 0 )); then { echo "Sorry, must be root. Exiting..."; exit; } fi
-echo "$(date): BEGIN backup: $0 $@"
-echo "$(date): $0 $SRC $DEST $@"
+echo "$(date): BEGIN backup: $0 $SRC $DEST $@"
do_init
do_prune 6 ""
do_prune 4 "-weekly"