diff options
author | Jonas Smedegaard <dr@jones.dk> | 2003-06-01 16:38:20 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2003-06-01 16:38:20 +0000 |
commit | 16beebdedcab715dedb0196d848eccaf61449c77 (patch) | |
tree | 97f075f8fda39211cd32454c49de48f17009aefb | |
parent | a386acafc4233f13ab2ad1ae024c7127334951be (diff) |
Handle empty stamp, and use it when run through cron.daily.
-rwxr-xr-x | localdumpsql | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/localdumpsql b/localdumpsql index ad4de22..a38a7a9 100755 --- a/localdumpsql +++ b/localdumpsql @@ -3,7 +3,7 @@ # /usr/local/sbin/localdumpsql # Copyright 2001-2003 Jonas Smedegaard <dr@jones.dk> # -# $Id: localdumpsql,v 1.12 2003-05-22 12:13:11 jonas Exp $ +# $Id: localdumpsql,v 1.13 2003-06-01 16:38:20 jonas Exp $ # # MySQL/PostgreSQL maintenance script # @@ -26,13 +26,13 @@ function usage() { # automagically configure when run from cron dirs case `dirname "$0"` in /etc/cron.daily) - stamp=daily + stamp="" ;; /etc/cron.weekly) - stamp=weekly + stamp="weekly" ;; /etc/cron.monthly) - stamp=monthly + stamp="monthly" ;; *) if [ $# -lt 1 -o $# -gt 4 ]; then @@ -94,7 +94,7 @@ for sqltype in $sqltypes; do chmod u=rX,go= "$targetdir" done for db in `${sqltype}_db_user "$databases" "$user"`; do - targetfile="$targetdir/$stamp.$db.sql" + targetfile="$targetdir/$db${stamp:+.$stamp}.sql" (set +e; ${sqltype}dump_user_db "$user" "$db"; set -e) > "$targetfile" chown "$user": "$targetfile" chmod u=r,go= "$targetfile" |