Files
VPS-scripts_Backup-Util/conf.sh
2022-11-10 15:04:07 +01:00

46 lines
1.7 KiB
Bash

mrepo=https://git.ictmaatwerk.com/VPS-scripts/Backup-Util
mbranch=master
############
# lftp #
############
sed -i -e '$a set ssl:verify-certificate no' /etc/lftp.conf
sed -i -e '$a set sftp:auto-confirm yes' /etc/lftp.conf
echo "set cmd:fail-exit true " >> /etc/lftp.conf
##############
# wp-cli #
##############
if [ ! -f /usr/local/bin/wp ]; then
curl --retry 7 --retry-delay 5 -s https://raw.githubusercontent.com/wp-cli/wp-cli/v2.4.0/utils/wp-completion.bash -o /etc/bash_completion.d/wp
curl --retry 7 --retry-delay 5 -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp
chmod +x /usr/local/bin/wp
fi
###################
# Backup-UTIL #
###################
mkdir -p /opt/BackupUtil
sed -i "\$a30 3 * * * root bash /opt/BackupUtil/Backup-Util.sh >/dev/null 2>&1" /etc/crontab
systemctl restart cron
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/Backup-Util.sh -o /opt/BackupUtil/Backup-Util.sh
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/Backup-Util/Backup-Util.unconfigured -o /opt/BackupUtil/Backup-Util.conf
sed -i -e 's/PASSword/'$password'/g' -e 's/HOSTNAME/'$(hostname -s)'/g' /opt/BackupUtil/Backup-Util.conf
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/Motd/51-bckupnotice -o /etc/update-motd.d/51-bckupnotice
chmod +x /etc/update-motd.d/51-bckupnotice
###################################
# Backup-util Site Setup #
# (For backwards compatibility) #
###################################
if [ -z "${itype}" ]; then
if [ -z ${db_suffix+x} ]; then db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`;fi
source <(curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/CMSHook-conf.sh)
fi