diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..408bf2d37e89c7080205a2e585290f1865a529bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +myftpdumper.conf diff --git a/myftpdumper.sample.conf b/myftpdumper.sample.conf new file mode 100644 index 0000000000000000000000000000000000000000..9a7b73c4e5ac8e3d64df196ff7b519e701ebf267 --- /dev/null +++ b/myftpdumper.sample.conf @@ -0,0 +1,38 @@ +### system settings +# Absolute path to local backup directory +declare -r BACKUP_PATH="" +# Send mail to this address in case of any errors. No mail if empty. +declare -r ADMINMAIL="" +# Keep so many backups or all if 0 +declare -r NUMBACKUPS=30 +# Combine tables of a database in single file +declare -r USE_TAR=1 +# Compression utility (like gzip, bzip2, xz, lzop), parameters allowed +# Disable compression if empty +declare -r COMPRESS="xz -T0" +# The umask that is used for the backup. Leave empty to keep unchanged +declare -r UMASK=0077 + +### MySQL settings +declare -r DB_HOST="" +declare -r DB_USER="" +declare -r DB_PASS="" +declare -r DB_EXCLUDE='^(?!(mysql|phpmyadmin|information_schema|performance_schema))' + +### Remote server settings +# Type of ftp connection: ftp, ftps, sftp +# Leave empty to disable upload +declare -r FTP_TYPE="" +declare -r FTP_HOST="" +declare -r FTP_USER="" +declare -r FTP_PASS="" # if empty, ssh key with no password is required +declare -r FTP_PORT="" # empty for default +declare -r FTP_KEYFILE="" # ssh key for sftp, empty for default +declare -r FTP_DIR="" +declare -r FTP_NUMBACKUPS=90 + +### GPG settings +# GPG key ID used for encryption starting with "0x" (preferred) +# or passphrase for symmetric encryption or empty (no encryption). +declare -r GPG_KEYID="" +declare -r GPG_PASS="" diff --git a/myftpdumper.sh b/myftpdumper.sh index a3d28b34371f6b9d030bc268544696d780014abe..be9b3cea3d88e3a7a7b9f32b2821c8310c026fc4 100755 --- a/myftpdumper.sh +++ b/myftpdumper.sh @@ -7,51 +7,6 @@ # to an (s)ftp server. Backups can be compressed and encrypted. ################################################################################ - - -#### BEGIN CONFIGURATION ####################################################### -### system settings -# Absolute path to local backup directory -declare -r BACKUP_PATH="" -# Send mail to this address in case of any errors. No mail if empty. -declare -r ADMINMAIL="" -# Keep so many backups or all if 0 -declare -r NUMBACKUPS=30 -# Combine tables of a database in single file -declare -r USE_TAR=1 -# Compression utility (like gzip, bzip2, xz, lzop), parameters allowed -# Disable compression if empty -declare -r COMPRESS="xz -T0" -# The umask that is used for the backup. Leave empty to keep unchanged -declare -r UMASK=0077 - -### MySQL settings -declare -r DB_HOST="" -declare -r DB_USER="" -declare -r DB_PASS="" -declare -r DB_EXCLUDE='^(?!(mysql|phpmyadmin|information_schema|performance_schema))' - -### Remote server settings -# Type of ftp connection: ftp, ftps, sftp -# Leave empty to disable upload -declare -r FTP_TYPE="" -declare -r FTP_HOST="" -declare -r FTP_USER="" -declare -r FTP_PASS="" # if empty, ssh key with no password is required -declare -r FTP_PORT="" # empty for default -declare -r FTP_KEYFILE="" # ssh key for sftp, empty for default -declare -r FTP_DIR="" -declare -r FTP_NUMBACKUPS=90 - -### GPG settings -# GPG key ID used for encryption starting with "0x" (preferred) -# or passphrase for symmetric encryption or empty (no encryption). -declare -r GPG_KEYID="" -declare -r GPG_PASS="" -################################################################################ - - - info() { echo "INFO: $1" } @@ -280,6 +235,16 @@ upload() { fi } +# get config +config_file=$(dirname $0)/"myftpdumper.conf" +if [[ $# -gt 0 ]]; then + config_file=$1 +fi +if [[ ! -f "$config_file" ]]; then + echo -e "USAGE: $0 path/to/config \nOr myftpdumper.conf file in same directory" >&2 + exit 1 +fi +source "$config_file" check_prerequisites