sync_from_old_server.sh: make password db for pure-FTPd service if possible.

This commit is contained in:
Christoph 2021-05-17 12:00:19 +02:00
parent 859fed5dc2
commit 31bb7eed62

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
ipv4_old=""
ipv4_old="83.223.86.98"
old_server_ip=$ipv4_old
tmp_err_msg=$(mktemp)
@ -8,7 +8,14 @@ log_dir=/root/sync_from_old_server_logs
# - Sync Home Directoties
# -
sync_home_dirs=""
#sync_home_dirs="
# /data/home/ilker
# /data/home/jan-kout
# /data/home/max
#"
sync_home_dirs="
/home/ilker
"
# - Sync web directories (included document root directory
@ -27,28 +34,32 @@ sync_home_dirs=""
# - the basename of the destination directory must be the same as
# - the basename of the source directory.
# -
sync_web_dirs=""
sync_web_dirs="
/var/www:/data/www
"
# - Sync Apache virtual host configurations
# -
# - Note:
# -
sync_vhost_dirs=""
sync_vhost_dirs="
/usr/local/apache2/conf/vhosts
"
# - Only needed to replace ip-addresse in virtual host configuration files
# -
ipv4_new=""
ipv6_old=""
ipv6_new=""
ipv4_new="162.55.82.78"
ipv6_old="2a01:30:0:13:211:84ff:feb7:7f9c"
ipv6_new="2a01:4f8:271:1266::78"
# - Sync dehydrated cert directory
# -
sync_dehydrated_dirs=""
#sync_dehydrated_dirs="
# /var/lib/dehydrated/certs
#"
sync_dehydrated_dirs="
/var/lib/dehydrated/certs
"
# - Sync other directories
@ -67,12 +78,17 @@ sync_dehydrated_dirs=""
# - the basename of the destination directory must be the same as
# - the basename of the source directory.
# -
sync_other_dirs=""
sync_other_dirs="
/root/bin/mysql/databases
/usr/local/webalizer/etc
"
# - Sync files
# -
sync_files=""
sync_files="
/etc/pure-ftpd/pureftpd.passwd
"
# - Sync Postgres databases
# -
@ -98,7 +114,7 @@ sync_pgsql_databases=""
# - ...
# - "
# -
sync_mysql_databases=""
sync_mysql_databases="ALL"
# - mysql_credential_args
# -
@ -657,6 +673,21 @@ if $_got_other_dirs ; then
done
fi
echo -e "\n\n \033[37m\033[1mSome post syncing stuff..\033[m\n"
echononl " Recreate PureFTPd's password database"
if [[ -f "/etc/pure-ftpd/pureftpd.passwd" ]]; then
pure-pw mkdb -f "/etc/pure-ftpd/pureftpd.passwd" > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
else
echo_skipped
fi
echo -e "\n\n \033[37m\033[1mRestart Services..\033[m\n"