From c7d4aaaa5b2e9b10c6551c4f6f75e0ca14b4a448 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 6 Aug 2013 21:57:46 +0200 Subject: [PATCH 01/22] Added README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e7bdc3 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +snippets +======== + +Meine Werkzeugssammlung + +I'm using this repository to gather various scripts and utities I'm using all day. +It's growing continously and hopefully other can profit for it. + +Everything ins this repo is licenced under GPLv3. From 93ee9d5bd582b3a66b7e403219006a5608e49795 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 6 Aug 2013 21:59:29 +0200 Subject: [PATCH 02/22] added uptime.sh uptime.sh is a sysv-init script which is executed when my server gets halted --- bash/uptime.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 bash/uptime.sh diff --git a/bash/uptime.sh b/bash/uptime.sh new file mode 100644 index 0000000..a3cebfd --- /dev/null +++ b/bash/uptime.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: uptime +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Default-Stop: 0 1 6 +# Short-Description: Log uptime of server before shutdown +### END INIT INFO + +echo $(date +%s) $(cat /proc/uptime) >> /var/log/uptime.log From 659a7c952c6f2eec3ec730a0f1d8a5287383a9e7 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 24 Aug 2013 17:34:12 +0200 Subject: [PATCH 03/22] replaced old cryptsetup script by new mount helper --- bash/mount.luks.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++ bash/mountcrypt.sh | 2 -- 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100755 bash/mount.luks.sh delete mode 100755 bash/mountcrypt.sh diff --git a/bash/mount.luks.sh b/bash/mount.luks.sh new file mode 100755 index 0000000..ca2fd75 --- /dev/null +++ b/bash/mount.luks.sh @@ -0,0 +1,67 @@ +#!/bin/bash +## + # [u]mount(8) helper for luks encrypted disks + # + # Both mount and umount offer the ability to handover the mounting + # process to a helper script. This is usefull when mounting/unmounting + # luks encrypted disks. This helper combines the following steps for mounting + # a disk: + # + # 1. cryptsetup luksOpen DEV UUID + # 2. mount -o helper=luks /dev/mapper/UUID DIR + # + # respectivly for unmounting + # + # 1. umount -i DEV + # 2. cryptsetup luksClose UUID + # + # + # USAGE: + # mount -t luks /dev/sda1 /home + # + # or via /etc/fstab: + # /dev/sda1 /home luks defaults 0 0 + # followed by: + # mount /home + # + # @copyright 2013 Steffen Vogel + # @license http://www.gnu.org/licenses/gpl.txt GNU Public License + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## + +if [ "$(basename $0)" == "mount.luks" ]; then + DEV=$1 + DIR=$2 + + shift 2 + OPTS=$@ + + UUID=$(cryptsetup luksUUID $DEV) + if [ $? -ne 0 ]; then + echo -e "$DEV is not a LUKS device" + exit 1 + fi + + cryptsetup luksOpen $DEV $UUID + mount $OPTS -o helper=luks /dev/mapper/$UUID $DIR + + # NOTE: The mount option '-o helper=luks' is essentially required + # because the encrypted filesystem is not of type "luks". + # This option tells umount to use this helper script, + # instead of using the normal unmounting procedure and + # leaving the dm-crypt volume unclosed and therefore unproteced! + +elif [ "$(basename $0)" == "umount.luks" ]; then + DEV=$(mount | grep $1 | cut -f 1 -d " ") + UUID=$(basename $DEV) + + shift + OPTS=$@ + + umount -i $OPTS $DEV + # NOTE: The umount option '-i' is essentially required. It skips this + # helper script which would cause otherwise an endless self recursion + + cryptsetup luksClose $UUID +fi diff --git a/bash/mountcrypt.sh b/bash/mountcrypt.sh deleted file mode 100755 index 600477f..0000000 --- a/bash/mountcrypt.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -gpg -d /media/STEFFEN-KEY/.secret/luks.key.enc | sudo pmount -p - $1 $2 From 2ba1c9b11fb93b787cab24aa631ecf5ec7b81928 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 24 Aug 2013 17:36:27 +0200 Subject: [PATCH 04/22] added short install hint --- bash/mount.luks.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/mount.luks.sh b/bash/mount.luks.sh index ca2fd75..334ea38 100755 --- a/bash/mount.luks.sh +++ b/bash/mount.luks.sh @@ -15,6 +15,8 @@ # 1. umount -i DEV # 2. cryptsetup luksClose UUID # + # INSTALL: + # place this script in /sbin/mount.luks and make it executable. # # USAGE: # mount -t luks /dev/sda1 /home From 351069965775ee06f59019d12f653d4836d7c223 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 27 Aug 2013 13:15:15 +0200 Subject: [PATCH 05/22] echo to stderr --- bash/mountl2p.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash/mountl2p.sh b/bash/mountl2p.sh index 65841d5..de7ef07 100755 --- a/bash/mountl2p.sh +++ b/bash/mountl2p.sh @@ -82,8 +82,7 @@ case ${FORMAT} in FORMAT="davs\://${L2P_USER}@www2.elearning.rwth-aachen.de\1/materials/documents L²P\:\2 \4" ;; *) - echo "invalid format!" >&2 - echo + echo -e "invalid format!" usage exit 1 esac From 7b86178c1dfaf5595409c77727ee29d5a1b661f0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 18 Oct 2013 14:53:34 +0200 Subject: [PATCH 06/22] added simple wrapper around bind9's nsupdate --- bash/nsupdate.sh | 159 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 bash/nsupdate.sh diff --git a/bash/nsupdate.sh b/bash/nsupdate.sh new file mode 100644 index 0000000..b5c340c --- /dev/null +++ b/bash/nsupdate.sh @@ -0,0 +1,159 @@ +#!/bin/bash +## + # Bind9 nsupdate wrapper + # + # @copyright 2013 Andrew Leonard + # @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + # @author Andrew Leonard + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## +## + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + # or implied. See the License for the specific language governing + # permissions and limitations under the License. +## + + +function usage { + echo "Usage: $0 CMD [FLAGS] HOST" + echo + echo " HOST is the hostname you want to update" + echo + echo " CMD is one of:" + echo " add, delete, update" + echo + echo " FLAGS are:" + echo " -n nameserver - DNS server to send updates to" + echo " -k file - Path to private key file" + echo " -y [hmac:]keyname:secret - key supplied via cli" + echo " -z zone - Zone to update" + echo " -t type - Record type; default is determined by -i,-4,-6 option" + echo " -d data - Record data / IP address" + echo " -i interface - Use the address of this interface as record data" + echo " -T ttl - Time to live for updated record; default: 1h." + echo " -4 / -6 use IP version" + exit 1 +} + +# parsing cmd +if [ "$1" == "add" -o "$1" == "delete" -o "$1" == "update" ]; then + CMD=$1 +else + echo -e "missing/invalid command" + echo + usage +fi + +shift 1 + +# default options +NS=localhost +TTL=3600 +OPTS= +VER=4 + +# parse arguments +while getopts "n:k:y:T:i:t:z:46" OPT ; do + case $OPT in + n) NS=$OPTARG ;; + k) KEYFILE=$OPTARG ;; + y) KEY=$OPTARG ;; + d) RDATA=$OPTARG ;; + t) TYPE=$OPTARG ;; + T) TTL=$OPTARG ;; + z) ZONE=$OPTARG ;; + i) IF=$OPTARG ;; + 4) VER=4 ;; + 6) VER=6 ;; + *) usage ;; + esac +done + +# clear all options and reset the command line +shift $((OPTIND-1)) + +# parsing host +if [ -n "$1" ]; then + HOST=$1 +else + echo -e "missing host" + echo + usage +fi + +if [ -n "$KEYFILE" ] ; then + OPTS="-k $KEYFILE" +elif [ -n "$KEY" ] ; then + OPTS="-y $KEY" +fi + +if [ -z "$ZONE" ] ; then + echo -e "missing zone" + echo + usage +fi + +if [ -z "$TYPE" ] ; then + case $VER in + 4) TYPE=A ;; + 6) TYPE=AAAA ;; + *) + echo "type missing" + usage + esac +fi + +# get current IPv4/6 address from net or interface +if [ -z "$RDATA" ] ; then + if [ -z "$IF" ] ; then + RDATA=$(curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]\{7,15\}\).*/\1/') + else + RDATA=$(ip -o -$VER address show dev $IF | sed -nr 's/.*inet6? ([^/ ]+).*/\1/p') + fi + +fi + +OPTS="$OPTS -v" + +# update zone +case $CMD in + add) + nsupdate $OPTS < Date: Fri, 18 Oct 2013 14:55:18 +0200 Subject: [PATCH 07/22] streamlined code --- bash/sddns.sh | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/bash/sddns.sh b/bash/sddns.sh index 4050a7c..c5cc56d 100755 --- a/bash/sddns.sh +++ b/bash/sddns.sh @@ -117,34 +117,17 @@ fi # parse arguments while getopts "z:p:u:t:i:Dhd46" OPT; do case ${OPT} in - p) - PASS=${OPTARG} - ;; - u) - USER=${OPTARG} - ;; - t) - TTL=${OPTARG} - ;; - 4) - VER=4 - ;; - 6) - VER=6 - ;; - i) - IF=${OPTARG} - ;; - D) - DAEMON=1 - ;; - d) - DEBUG=${OPTARG:-5} - ;; + p) PASS=${OPTARG} ;; + u) USER=${OPTARG} ;; + t) TTL=${OPTARG} ;; + 4) VER=4 ;; + 6) VER=6 ;; + i) IF=${OPTARG} ;; + D) DAEMON=1 ;; + d) DEBUG=${OPTARG:-5} ;; h) usage - exit 0 - ;; + exit 0 ;; *) usage exit 1 From 46313724b11e98b9bcbfa85530f4d9ce1fe8ed2a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 18 Oct 2013 15:03:46 +0200 Subject: [PATCH 08/22] added dhclient update hook Add this file to /etc/dhcp/dhclient-exit-hooks.d/nsupdate to update your dns autmatically when you get a new DHCP/IP lease from your ISP --- bash/dhclient-exit-hook-nsupdate.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bash/dhclient-exit-hook-nsupdate.sh diff --git a/bash/dhclient-exit-hook-nsupdate.sh b/bash/dhclient-exit-hook-nsupdate.sh new file mode 100644 index 0000000..838eb32 --- /dev/null +++ b/bash/dhclient-exit-hook-nsupdate.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +NS=/usr/local/bin/nsupdate.sh +key=/etc/bind/dhcp.key +zone=0l.de +host=wg.0l.de +server=127.0.0.1 + +case $reason in + BOUND|RENEW|REBIND|TIMEOUT) + $NS update -d $new_ip_address -k $key -z $zone -n $server -i $interface $host ;; + RELEASE) + $NS delete -d $old_ip_address -k $key -z $zone -n $server $host ;; +esac From 6bb68be863eb6604a343307cb55292f5416a6e91 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 18 Oct 2013 15:04:57 +0200 Subject: [PATCH 09/22] Update and rename dhclient-exit-hook-nsupdate.sh to nsupdate-dhclient-exit-hook.sh --- bash/dhclient-exit-hook-nsupdate.sh | 14 ------------ bash/nsupdate-dhclient-exit-hook.sh | 33 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 14 deletions(-) delete mode 100644 bash/dhclient-exit-hook-nsupdate.sh create mode 100644 bash/nsupdate-dhclient-exit-hook.sh diff --git a/bash/dhclient-exit-hook-nsupdate.sh b/bash/dhclient-exit-hook-nsupdate.sh deleted file mode 100644 index 838eb32..0000000 --- a/bash/dhclient-exit-hook-nsupdate.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -NS=/usr/local/bin/nsupdate.sh -key=/etc/bind/dhcp.key -zone=0l.de -host=wg.0l.de -server=127.0.0.1 - -case $reason in - BOUND|RENEW|REBIND|TIMEOUT) - $NS update -d $new_ip_address -k $key -z $zone -n $server -i $interface $host ;; - RELEASE) - $NS delete -d $old_ip_address -k $key -z $zone -n $server $host ;; -esac diff --git a/bash/nsupdate-dhclient-exit-hook.sh b/bash/nsupdate-dhclient-exit-hook.sh new file mode 100644 index 0000000..f9c92a2 --- /dev/null +++ b/bash/nsupdate-dhclient-exit-hook.sh @@ -0,0 +1,33 @@ +#!/bin/bash +## + # dhclient wrapper to update your dns + # + # @copyright 2013 Steffen Vogel + # @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## +## + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + # or implied. See the License for the specific language governing + # permissions and limitations under the License. +## + +NS=/usr/local/bin/nsupdate.sh +key=/etc/bind/dhcp.key +zone=0l.de +host=wg.0l.de +server=127.0.0.1 + +case $reason in + BOUND|RENEW|REBIND|TIMEOUT) + $NS update -d $new_ip_address -k $key -z $zone -n $server -i $interface $host ;; + RELEASE) + $NS delete -d $old_ip_address -k $key -z $zone -n $server $host ;; +esac From dbe3e176b294d0b10ab0cba58c0183c44afcde62 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 18 Oct 2013 15:06:21 +0200 Subject: [PATCH 10/22] added install note --- bash/nsupdate-dhclient-exit-hook.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash/nsupdate-dhclient-exit-hook.sh b/bash/nsupdate-dhclient-exit-hook.sh index f9c92a2..605a597 100644 --- a/bash/nsupdate-dhclient-exit-hook.sh +++ b/bash/nsupdate-dhclient-exit-hook.sh @@ -6,6 +6,9 @@ # @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 # @author Steffen Vogel # @link http://www.steffenvogel.de + # + # Add this file to /etc/dhcp/dhclient-exit-hooks.d/nsupdate + # to update your dns autmatically when you get a new DHCP/IP lease from your ISP ## ## # Licensed under the Apache License, Version 2.0 (the "License"); From 229a6c66a49e506233975a5ca2af20acad9317f6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 20 Oct 2013 12:14:18 +0200 Subject: [PATCH 11/22] updated description formatting --- php/campus/cocal.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/php/campus/cocal.php b/php/campus/cocal.php index d4a4512..c2a07c6 100644 --- a/php/campus/cocal.php +++ b/php/campus/cocal.php @@ -104,6 +104,7 @@ function crawl_address($room) { return (count($matches)) ? $matches : false; } +/* send HTTP 500 for Google to stop fetching */ function error() { global $scriptUrl; @@ -194,16 +195,24 @@ if (isset($matrnr) && isset($passwd)) { } $address = array(); + $category = ''; $lines = explode("\r\n", $body); foreach ($lines as $line) { if ($line) { list($key, $value) = explode(":", $line); switch ($key) { case 'END': - if ($value == 'VEVENT') flush(); - $address = array(); + if ($value == 'VEVENT') { + flush(); + $address = array(); + $category = ''; + } break; + case 'CATEGORIES': + $category = $value; + + case 'LOCATION': $matches = array(); if (preg_match('/^([0-9]+\|[0-9]+)/', $value, $matches)) { @@ -225,20 +234,20 @@ if (isset($matrnr) && isset($passwd)) { $additional = $value; $value = ''; - if (@$address['building_no'] && @$address['room_no']) - $value .= '\n' . $address['building_no'] . '|' . $address['room_no']; + if (@$address['building'] || @address['building_no']) + $value .= '\nGebäude: ' . $address['building_no'] . ' ' . $address['building']; - if (@$address['room']) - $value .= ' ' . $address['room']; - - if (@$address['building']) - $value .= '\n' . 'Gebäude: ' . $address['building']; + if (@$address['room'] || @$address['room_no']) + $value .= '\nRaum: ' . $address['room_no'] . ' ' . $address['room']; if (@$address['floor']) - $value .= '\n' . 'Geschoss: ' . $address['floor']; + $value .= '\nGeschoss: ' . $address['floor']; if (@$address['cluster']) - $value .= '\n' . 'Campus: ' . preg_replace('/^Campus /', '', $address['cluster']); + $value .= '\nCampus: ' . preg_replace('/^Campus /', '', $address['cluster']); + + if (@$category) + $value .= '\nTyp: ' . $category; if ($additional && $additional != 'Kommentar') $value .= '\n' . $additional; From eff09da1d163b4f32bda932af70cbcd388fcba9c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 20 Oct 2013 12:17:16 +0200 Subject: [PATCH 12/22] fixed typo --- php/campus/cocal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/campus/cocal.php b/php/campus/cocal.php index c2a07c6..44472c6 100644 --- a/php/campus/cocal.php +++ b/php/campus/cocal.php @@ -234,7 +234,7 @@ if (isset($matrnr) && isset($passwd)) { $additional = $value; $value = ''; - if (@$address['building'] || @address['building_no']) + if (@$address['building'] || @$address['building_no']) $value .= '\nGebäude: ' . $address['building_no'] . ' ' . $address['building']; if (@$address['room'] || @$address['room_no']) From f6224bac7bfd4c3dc88669c4ff1eeb2eebfb20a8 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Oct 2013 10:12:17 +0200 Subject: [PATCH 13/22] added workaround for Sipgate's SMS API --- sms_contact/aws.php | 38 ----------------------------------- sms_contact/xmlrpc/xmlrpc.inc | 4 ++-- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 sms_contact/aws.php diff --git a/sms_contact/aws.php b/sms_contact/aws.php deleted file mode 100644 index 6e77544..0000000 --- a/sms_contact/aws.php +++ /dev/null @@ -1,38 +0,0 @@ -getBalance(); - $message = preg_replace('/\r?\n/m', '\n', trim($json['Message'])); - - if ($balance < $config['reserve']) { - header("HTTP/1.0 402 Payment Required"); - } - else { - $sipgate->sendSMS($config['recipient'], $message, NULL, $config['recipient']); - } - break; - - default: - header("HTTP/1.1 501 Not Implemented"); - } -} -else { - header("HTTP/1.1 405 Method Not Allowed"); -} - -?> diff --git a/sms_contact/xmlrpc/xmlrpc.inc b/sms_contact/xmlrpc/xmlrpc.inc index b3658f0..f6a7ee0 100644 --- a/sms_contact/xmlrpc/xmlrpc.inc +++ b/sms_contact/xmlrpc/xmlrpc.inc @@ -820,7 +820,7 @@ var $key=''; var $keypass=''; var $verifypeer=true; - var $verifyhost=1; + var $verifyhost=2; var $no_multicall=false; var $proxy=''; var $proxyport=0; @@ -3773,4 +3773,4 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha } } -?> \ No newline at end of file +?> From e7f22d31c673958c224e3fd04456964d1cbd3c34 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Oct 2013 10:16:58 +0200 Subject: [PATCH 14/22] renamed geocaching.com spider script (propably outdated) --- gc.com_spider/cookie.txt | 5 ----- {gc.com_spider => gc_spider}/.buildpath | 0 {gc.com_spider => gc_spider}/gc.kml | 0 {gc.com_spider => gc_spider}/icons/accept.png | Bin {gc.com_spider => gc_spider}/icons/delete.png | Bin {gc.com_spider => gc_spider}/icons/gc-cito.gif | Bin .../icons/gc-earthcache.gif | Bin {gc.com_spider => gc_spider}/icons/gc-event.gif | Bin {gc.com_spider => gc_spider}/icons/gc-letterbox.gif | Bin {gc.com_spider => gc_spider}/icons/gc-megaevent.gif | Bin {gc.com_spider => gc_spider}/icons/gc-multi.gif | Bin {gc.com_spider => gc_spider}/icons/gc-mystery.gif | Bin .../icons/gc-traditional.gif | Bin {gc.com_spider => gc_spider}/icons/gc-virtual.gif | Bin {gc.com_spider => gc_spider}/icons/gc-webcam.gif | Bin {gc.com_spider => gc_spider}/include/classes/gc.php | 0 {gc.com_spider => gc_spider}/index.php | 0 {gc.com_spider => gc_spider}/json_response | 0 {gc.com_spider => gc_spider}/kml.php | 0 {gc.com_spider => gc_spider}/post_request_data | 0 20 files changed, 5 deletions(-) delete mode 100755 gc.com_spider/cookie.txt rename {gc.com_spider => gc_spider}/.buildpath (100%) rename {gc.com_spider => gc_spider}/gc.kml (100%) rename {gc.com_spider => gc_spider}/icons/accept.png (100%) rename {gc.com_spider => gc_spider}/icons/delete.png (100%) rename {gc.com_spider => gc_spider}/icons/gc-cito.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-earthcache.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-event.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-letterbox.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-megaevent.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-multi.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-mystery.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-traditional.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-virtual.gif (100%) rename {gc.com_spider => gc_spider}/icons/gc-webcam.gif (100%) rename {gc.com_spider => gc_spider}/include/classes/gc.php (100%) rename {gc.com_spider => gc_spider}/index.php (100%) rename {gc.com_spider => gc_spider}/json_response (100%) rename {gc.com_spider => gc_spider}/kml.php (100%) rename {gc.com_spider => gc_spider}/post_request_data (100%) diff --git a/gc.com_spider/cookie.txt b/gc.com_spider/cookie.txt deleted file mode 100755 index 099071a..0000000 --- a/gc.com_spider/cookie.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# http://curlm.haxx.se/rfc/cookie_spec.html -# This file was generated by libcurl! Edit at your own risk. - -#HttpOnly_www.geocaching.com FALSE / FALSE 0 ASP.NET_SessionId kpnkhincysmgh2z2wwxayp55 diff --git a/gc.com_spider/.buildpath b/gc_spider/.buildpath similarity index 100% rename from gc.com_spider/.buildpath rename to gc_spider/.buildpath diff --git a/gc.com_spider/gc.kml b/gc_spider/gc.kml similarity index 100% rename from gc.com_spider/gc.kml rename to gc_spider/gc.kml diff --git a/gc.com_spider/icons/accept.png b/gc_spider/icons/accept.png similarity index 100% rename from gc.com_spider/icons/accept.png rename to gc_spider/icons/accept.png diff --git a/gc.com_spider/icons/delete.png b/gc_spider/icons/delete.png similarity index 100% rename from gc.com_spider/icons/delete.png rename to gc_spider/icons/delete.png diff --git a/gc.com_spider/icons/gc-cito.gif b/gc_spider/icons/gc-cito.gif similarity index 100% rename from gc.com_spider/icons/gc-cito.gif rename to gc_spider/icons/gc-cito.gif diff --git a/gc.com_spider/icons/gc-earthcache.gif b/gc_spider/icons/gc-earthcache.gif similarity index 100% rename from gc.com_spider/icons/gc-earthcache.gif rename to gc_spider/icons/gc-earthcache.gif diff --git a/gc.com_spider/icons/gc-event.gif b/gc_spider/icons/gc-event.gif similarity index 100% rename from gc.com_spider/icons/gc-event.gif rename to gc_spider/icons/gc-event.gif diff --git a/gc.com_spider/icons/gc-letterbox.gif b/gc_spider/icons/gc-letterbox.gif similarity index 100% rename from gc.com_spider/icons/gc-letterbox.gif rename to gc_spider/icons/gc-letterbox.gif diff --git a/gc.com_spider/icons/gc-megaevent.gif b/gc_spider/icons/gc-megaevent.gif similarity index 100% rename from gc.com_spider/icons/gc-megaevent.gif rename to gc_spider/icons/gc-megaevent.gif diff --git a/gc.com_spider/icons/gc-multi.gif b/gc_spider/icons/gc-multi.gif similarity index 100% rename from gc.com_spider/icons/gc-multi.gif rename to gc_spider/icons/gc-multi.gif diff --git a/gc.com_spider/icons/gc-mystery.gif b/gc_spider/icons/gc-mystery.gif similarity index 100% rename from gc.com_spider/icons/gc-mystery.gif rename to gc_spider/icons/gc-mystery.gif diff --git a/gc.com_spider/icons/gc-traditional.gif b/gc_spider/icons/gc-traditional.gif similarity index 100% rename from gc.com_spider/icons/gc-traditional.gif rename to gc_spider/icons/gc-traditional.gif diff --git a/gc.com_spider/icons/gc-virtual.gif b/gc_spider/icons/gc-virtual.gif similarity index 100% rename from gc.com_spider/icons/gc-virtual.gif rename to gc_spider/icons/gc-virtual.gif diff --git a/gc.com_spider/icons/gc-webcam.gif b/gc_spider/icons/gc-webcam.gif similarity index 100% rename from gc.com_spider/icons/gc-webcam.gif rename to gc_spider/icons/gc-webcam.gif diff --git a/gc.com_spider/include/classes/gc.php b/gc_spider/include/classes/gc.php similarity index 100% rename from gc.com_spider/include/classes/gc.php rename to gc_spider/include/classes/gc.php diff --git a/gc.com_spider/index.php b/gc_spider/index.php similarity index 100% rename from gc.com_spider/index.php rename to gc_spider/index.php diff --git a/gc.com_spider/json_response b/gc_spider/json_response similarity index 100% rename from gc.com_spider/json_response rename to gc_spider/json_response diff --git a/gc.com_spider/kml.php b/gc_spider/kml.php similarity index 100% rename from gc.com_spider/kml.php rename to gc_spider/kml.php diff --git a/gc.com_spider/post_request_data b/gc_spider/post_request_data similarity index 100% rename from gc.com_spider/post_request_data rename to gc_spider/post_request_data From 0128c69e077be8adf69c4815618cba973c0f61cb Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Oct 2013 10:18:16 +0200 Subject: [PATCH 15/22] removed caching database from git --- .gitignore | 2 ++ php/campus/cocal.db | Bin 5120 -> 0 bytes 2 files changed, 2 insertions(+) delete mode 100644 php/campus/cocal.db diff --git a/.gitignore b/.gitignore index f16baa8..a93c4b5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .project .classpath +gc_spider/cookie.txt +php/campus/cocal.db diff --git a/php/campus/cocal.db b/php/campus/cocal.db deleted file mode 100644 index c71f666c285b61c55a8f32ed0bde784511db317f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5120 zcmeHK&5I*N6tC(^W~OH+vm0axqLG3{m}oL~RVO=%IA~|+?TI__qbJU=>|yAc)NF!1 z-Lu^tStJOuN4*N(JPF)XSK;Uhmdb|S2U9DoqKgfRdL0|4atGii{&h-cEK-zQ_Kp6jUn@ng8zl&aUZ33zZ@4_W_nlGXOL<>9v`=J*IPp1= z;1K;OVvvtJ@tU=afsBDipMl)+B6qTgE&}u`+CZP7J@hiVfxbW*x{KaHeRL6hjDAP& zq3_U#k3JijhZzHZ!@v?ML(-($m}+`a3Uwh6?Sd3EB4)^WDd;UR(_EGUsSAM=q!25h zOHvRDG>x2_njwoqpn8LjHA>V(xHQ%p+QQVb^?501d>@^XIVr^2XgR} z_dzj+8%lJd$YnwSp&Bf3hnK-MfWAa7qRJo2r%I$~@Mri5?86ec13uuB|E)Eb)pF(O zf>KgeNWx3Ui{55o6ga0JG2Ga6j!#A*?hd1f<-IM;i32~;wO6ed3TpW|j(nUW6B74M zZ@aF?f(e*TgL6@vaWnyU1iHPXmS5!P6^>3=H;3*~csTF_k6+4${3o`6%$P9$sR1}u^!SZNDd(-!34w}R8#+&;W@`gssKj*E>hUbTV>G_Cex+8}avg9!Lq z7__dcg>_>K?^5o|eA<`wv-?s9-wR(_b1}J(@c<z% zZJQ?pXy_c;$;Z&vUvZ%iiHq%vYxqo5Y`>zI)}>s`Xh{+ylO{#X3;~oA(Aj;;w3_=Nw7xE?qM%)>2h`ee*icTCK4ou7kUB}Q6GnTV>vlW`W=m;_O#1p3Wz z4hPKZ@`ELM;fCY746lmdR=_Q?X1uX&)U4;BT5fQQig1M{dEI5M6G;eSwQmI`~%9!On%anCZL@CRd7w6f-OE f`ImF1oPi(Z=iz)@T8g5i#ut)*FD;!;{9SnfO0w&O From 556b007483cd15b828efb0999abb213b69409a7f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Oct 2013 10:18:58 +0200 Subject: [PATCH 16/22] added mysql backup script --- bash/backupmysql.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 bash/backupmysql.sh diff --git a/bash/backupmysql.sh b/bash/backupmysql.sh new file mode 100755 index 0000000..4af05e0 --- /dev/null +++ b/bash/backupmysql.sh @@ -0,0 +1,39 @@ +#!/bin/bash +## + # Backup all mySQL databases + # + # @copyright 2013 Steffen Vogel + # @license http://www.gnu.org/licenses/gpl.txt GNU Public License + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## +## + # This script is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation, either version 3 of the License, or + # any later version. + # + # This script 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. + # + # You should have received a copy of the GNU General Public License + # along with this script. If not, see . + ## + +TIMESTAMP=$(date +"%Y-%m-%dT%H:%M:%S") +BACKUP_DIR="/backup/mysql/$TIMESTAMP" +MYSQL_USER="backup" +MYSQL=/usr/bin/mysql +MYSQL_PASSWORD="password" +MYSQLDUMP=/usr/bin/mysqldump + +DATABASES=`$MYSQL -u$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"` + +mkdir -p $BACKUP_DIR +for db in $DATABASES; do + $MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --events --databases $db | gzip > "$BACKUP_DIR/$db.gz" +done + + From c248cb851182c868b0a5ef89d02f65ece4bf1ad3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 1 Nov 2013 03:56:46 +0100 Subject: [PATCH 17/22] added a first version of my Btrfs snapshot backup script For usage details please consult the file header and https://btrfs.wiki.kernel.org/index.php/Incremental_Backup --- bash/backup-btrfs.sh | 93 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 bash/backup-btrfs.sh diff --git a/bash/backup-btrfs.sh b/bash/backup-btrfs.sh new file mode 100644 index 0000000..48fc98a --- /dev/null +++ b/bash/backup-btrfs.sh @@ -0,0 +1,93 @@ +#!/bin/bash +## + # Incremental backups with Btrfs snapshots + # + # This script does incremental backups of Btrfs subvolumes + # across filesystem boundaries as proposed in the Btrfs wiki: + # https://btrfs.wiki.kernel.org/index.php/Incremental_Backup + # + # It uses the 'btrfs send' and 'btrfs receive' commands. + # Its not intended for simple snapshots in a single filesystem enviroment. + # + # @copyright 2013 Steffen Vogel + # @license http://www.gnu.org/licenses/gpl.txt GNU Public License + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## +## + # This script is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation, either version 3 of the License, or + # any later version. + # + # This script 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. + # + # You should have received a copy of the GNU General Public License + # along with this script. If not, see . + ## + +# TODO: delete old snapshots in destination fs +# TODO: print statistics of send | receive pipe (speed & size) + +function usage { + echo "Usage: $(basename $0) SOURCE [DEST]" + echo + echo " SOURCE a path to the subvolume to backup" + echo " DEST an optional path to the backup destination" + echo " only required for initialization" + exit 1 +} + +set -e + +if [ $# -lt 1 ]; then + echo -e "missing source" + echo + usage +fi + +SRC=$(readlink -f "$1") + +if [ -h "$SRC/.backup/destination" ]; then + DEST=$(readlink -f "$SRC/.backup/destination") +elif [ $# -ne 2 ] ; then + echo -e "missing destination" + echo + usage +else + DEST=$(readlink -f $2) + + mkdir -p "$SRC/.backup/" + mkdir -p "$DEST" + + ln -sf "$DEST" "$SRC/.backup/destination" + ln -sf "$SRC" "$DEST/source" +fi + +# name for the new snapshot +SNAPSHOT=$(date +%F_%H-%M-%S) +LATEST="$SRC/.backup/$SNAPSHOT" + +# snapshot the current state +btrfs subvolume snapshot -r "$SRC" "$LATEST" + +# send changes +if [ -h "$DEST/latest-source" ]; then + PREVIOUS=$(readlink -f "$DEST/latest-source") + btrfs send -p "$PREVIOUS" "$LATEST" | btrfs receive "$DEST" +else + btrfs send "$LATEST" | btrfs receive "$DEST" +fi + +# delete old snapshot in source fs +if [ -n "$PREVIOUS" ]; then + btrfs subvolume delete "$PREVIOUS" +fi + +# update links to last backup +ln -rsfT "$DEST/$SNAPSHOT" "$DEST/latest" +ln -sfT "$LATEST" "$DEST/latest-source" + From 9ba40d8cbedc4c9a459ac314c0556f15a306237d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 1 Nov 2013 04:21:32 +0100 Subject: [PATCH 18/22] Rename backupmysql.sh to backup-mysql.sh --- bash/{backupmysql.sh => backup-mysql.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bash/{backupmysql.sh => backup-mysql.sh} (100%) mode change 100755 => 100644 diff --git a/bash/backupmysql.sh b/bash/backup-mysql.sh old mode 100755 new mode 100644 similarity index 100% rename from bash/backupmysql.sh rename to bash/backup-mysql.sh From ef787905b51b75b9d08bffe65e14176fae9b62e1 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 8 Nov 2013 16:49:03 +0100 Subject: [PATCH 19/22] added bash script for remote rsync/btrfs snapshot backups see file header for usage details --- bash/backup-remote.sh | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 bash/backup-remote.sh diff --git a/bash/backup-remote.sh b/bash/backup-remote.sh new file mode 100644 index 0000000..8fb77a2 --- /dev/null +++ b/bash/backup-remote.sh @@ -0,0 +1,63 @@ +#!/bin/bash +## + # Sync with remote server and create btrfs snapshots + # + # This scripts uses rsync to sync remote directories with a local copy + # After every successful sync a readonly btrfs snapshot of this copy is + # created + # + # This script requires root privileges! Consider using public key auth- + # entification with SSH and allow root logins only with a private key: + # + # On remote side: + # echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config: + # + # On local side: + # sudo ssh-keygen + # sudo cat /root/.ssh/id_dsa.pub | ssh user@remote 'cat >> /root/.ssh/authorized_keys' + # + # @copyright 2013 Steffen Vogel + # @license http://www.gnu.org/licenses/gpl.txt GNU Public License + # @author Steffen Vogel + # @link http://www.steffenvogel.de + ## +## + # This script is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation, either version 3 of the License, or + # any later version. + # + # This script 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. + # + # You should have received a copy of the GNU General Public License + # along with this script. If not, see . + ## + +function usage { + echo "Usage: $(basename $0) REMOTE LOCAL" + echo + echo " REMOTE a rsync source path/server" + echo " LOCAL the local destination directory" + exit 1 +} + +set -e + +if [ $# -ne 2 ]; then + usage +fi + +HOST=$1 +DIR=$2 + +DATE=$(date +%F_%H-%M-%S) +EXCLUDE=/dev,/proc,/sys,/tmp,/run,/mnt,/media,/lost+found + +# sync with remote +rsync -aAX --delete root@$HOST:/ $DIR/latest --exclude={$EXCLUDE} + +# create new readonly snapshot +btrfs subvolume snapshot -r $DIR/latest $DIR/$DATE From e6a99d2f7f898508c33e520a6ef5fc9a96ef872c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 8 Nov 2013 17:48:35 +0100 Subject: [PATCH 20/22] some rewrite for my rsync backup script --- bash/backup-remote.sh | 54 ++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/bash/backup-remote.sh b/bash/backup-remote.sh index 8fb77a2..879f46b 100644 --- a/bash/backup-remote.sh +++ b/bash/backup-remote.sh @@ -1,13 +1,14 @@ #!/bin/bash ## - # Sync with remote server and create btrfs snapshots + # Sync with remote server and create Btrfs snapshots # # This scripts uses rsync to sync remote directories with a local copy - # After every successful sync a readonly btrfs snapshot of this copy is + # After every successful sync a readonly Btrfs snapshot of this copy is # created # - # This script requires root privileges! Consider using public key auth- - # entification with SSH and allow root logins only with a private key: + # This script requires root privileges for creating Btrfs snapshots. + # Consider using public key authentification with SSH to allow root + # logins on remote machines: # # On remote side: # echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config: @@ -37,27 +38,54 @@ ## function usage { - echo "Usage: $(basename $0) REMOTE LOCAL" + echo "Usage: $(basename $0) SOURCE DEST" echo - echo " REMOTE a rsync source path/server" - echo " LOCAL the local destination directory" + echo " SOURCE a path to the subvolume to backup" + echo " DEST a path to the backup destination" exit 1 } set -e if [ $# -ne 2 ]; then + echo -e "invalid args!" + echo usage fi -HOST=$1 -DIR=$2 - DATE=$(date +%F_%H-%M-%S) -EXCLUDE=/dev,/proc,/sys,/tmp,/run,/mnt,/media,/lost+found + +SRC=$1 +DEST=$(readlink -f $2) + +if ! btrfs sub show $DEST/.current &> /dev/null; then + if [ -d $DEST/.current ]; then + echo -e "destination directory exists and is not a valid btrfs subvolume!" + echo + usage + else + btrfs sub create $DEST/.current + fi +fi + +# rsync options +OPTS="--archive --acls --xattrs" +OPTS+=" --progress --human-readable" +OPTS+=" --delete --delete-excluded" +OPTS+=" --exclude /dev/" +OPTS+=" --exclude /proc/" +OPTS+=" --exclude /sys/" +OPTS+=" --exclude /tmp/" +OPTS+=" --exclude /run/" +OPTS+=" --exclude /mnt/" +OPTS+=" --exclude /media/" +OPTS+=" --exclude /lost+found/" # sync with remote -rsync -aAX --delete root@$HOST:/ $DIR/latest --exclude={$EXCLUDE} +rsync $OPTS $SRC $DEST/.current/ # create new readonly snapshot -btrfs subvolume snapshot -r $DIR/latest $DIR/$DATE +btrfs subvolume snapshot -r $DEST/.current $DEST/$DATE + +# create symlink to latest snapshot +ln -sf $DATE latest From c5d1e04d6ac871dc48fde3a46081919f094d74cc Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 8 Nov 2013 18:58:49 +0100 Subject: [PATCH 21/22] fixed symlink creation --- bash/backup-remote.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/backup-remote.sh b/bash/backup-remote.sh index 879f46b..6de151c 100644 --- a/bash/backup-remote.sh +++ b/bash/backup-remote.sh @@ -88,4 +88,4 @@ rsync $OPTS $SRC $DEST/.current/ btrfs subvolume snapshot -r $DEST/.current $DEST/$DATE # create symlink to latest snapshot -ln -sf $DATE latest +ln -rsfT $DATE latest From 403f1dc831bf793a763ea1fb947935e44b06bb10 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 8 Nov 2013 19:00:00 +0100 Subject: [PATCH 22/22] rewrite of mysql backup script --- bash/backup-mysql.sh | 95 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 11 deletions(-) diff --git a/bash/backup-mysql.sh b/bash/backup-mysql.sh index 4af05e0..53f9f6c 100644 --- a/bash/backup-mysql.sh +++ b/bash/backup-mysql.sh @@ -1,6 +1,6 @@ #!/bin/bash ## - # Backup all mySQL databases + # Backup mySQL databases in separate sql dumps # # @copyright 2013 Steffen Vogel # @license http://www.gnu.org/licenses/gpl.txt GNU Public License @@ -22,18 +22,91 @@ # along with this script. If not, see . ## -TIMESTAMP=$(date +"%Y-%m-%dT%H:%M:%S") -BACKUP_DIR="/backup/mysql/$TIMESTAMP" -MYSQL_USER="backup" -MYSQL=/usr/bin/mysql -MYSQL_PASSWORD="password" -MYSQLDUMP=/usr/bin/mysqldump +set -e -DATABASES=`$MYSQL -u$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"` +function usage { + cat <<-EOF + Usage: $(basename $0) [-u USER] [-p PASSWORD] DIR -mkdir -p $BACKUP_DIR -for db in $DATABASES; do - $MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --events --databases $db | gzip > "$BACKUP_DIR/$db.gz" + DIR is the directory for the backups (defaults to cwd) + + Options: + -u mysql username + -p mysql password + -h show this help + -d enable verbose output + + written by Steffen Vogel + EOF +} + +function deps() { + FAILED=0 + for DEP in $*; do + if ! which ${DEP} &>/dev/null; then + echo -e "This script requires ${DEP} to run but it is not installed." + ((FAILED++)) + fi + done + return ${FAILED} +} + +if ! deps mysql mysqldump; then + echo -e "mysql tools missing!" + echo + usage + exit 1 +fi + +# parse arguments +while getopts "u:p:hd" OPT; do + case ${OPT} in + p) MYSQL_PASS=${OPTARG} ;; + u) MYSQL_USER=${OPTARG} ;; + d) V=1 ;; + h) + usage + exit 0 ;; + *) + usage + exit 1 + esac done +# clear all options and reset the command line +shift $((OPTIND-1)) + +# parsing backup directory +if [ -n "$1" ]; then + DIR=$(readlink -f $1) +else + DIR=$(pwd) +fi + +# mySQL options +OPTS="" +if [ -n "$MYSQL_USER" ]; then + OPTS+=" -u$MYSQL_USER" +fi + +if [ -n "$MYSQL_PASS" ]; then + OPTS+=" -p$MYSQL_PASS" +fi + +# get all databases +DATABASES=`mysql $OPTS -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"` +DATE=$(date +%F_%H-%M-%S) + +mkdir -p $DIR/$DATE +ln -rsfT $DIR/$DATE/ $DIR/latest + +[ -z "$V" ] || echo "Starting mySQL backup: $(date)" +[ -z "$V" ] || echo "$(echo '$DATABASES' | wc -l) databases" +[ -z "$V" ] || echo "Backup directory: $DIR/$DATE" +for db in $DATABASES; do + [ -z "$V" ] || echo -n "Dumping $db ..." + mysqldump $OPTS --force --opt --events --databases $db | gzip > "$DIR/$DATE/$db.sql.gz" + [ -z "$V" ] || echo -e "\b\b\binto $DIR/$DATE/$db.sql.gz ($(du -h $DIR/$DATE/$db.sql.gz | cut -f1))" +done +[ -z "$V" ] || echo "Finished mySQL backup: $(date) ($(du -hs $DIR/$DATE/ | cut -f1))"