]> arthur.barton.de Git - MkMySqlDump.git/commitdiff
Implement "--outdir|-d" option
authorAlexander Barton <alex@barton.de>
Mon, 3 Aug 2015 14:37:13 +0000 (16:37 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 3 Aug 2015 14:37:13 +0000 (16:37 +0200)
bin/mkmysqldump

index 64df8419d689c97e10a2e3bee9cf2e11e4bb5565..8489f2eeaab359f5d864513a6d083b9137488d05 100755 (executable)
@@ -24,6 +24,8 @@ Help() {
        echo "      MySQL server password [\"$MYPW\"]".
        echo "  --outfile|-o <file>"
        echo "      Path and name of SQL dump file [\"$OUTFILE\"]."
+       echo "  --outdir|-d <directory>"
+       echo "      Directory for automatically named dump files."
        echo "  --summary|-s"
        echo "      Display file and file system status summary."
        echo
@@ -63,6 +65,11 @@ while [ $# -gt 0 ]; do
                OUTFILE="$2"
                shift 2
                ;;
+         "--outdir"|"-d")
+               [ $# -ge 2 ] || Usage
+               OUTFILE="$2/$(hostname -s)-$(date "+%Y%m%d-%H%M%S").sql"
+               shift 2
+               ;;
          "--summary"|"-s")
                STATS=1
                shift