Tidying
This commit is contained in:
parent
dbb6eb21ec
commit
3c963836c4
|
@ -119,7 +119,7 @@ function backup_database_to_friend {
|
|||
fi
|
||||
}
|
||||
|
||||
# configuration files
|
||||
function backup_configuration {
|
||||
echo $"Backing up ${PROJECT_NAME} configuration files"
|
||||
if [ ! -d /root/tempbackupconfig ]; then
|
||||
mkdir -p /root/tempbackupconfig
|
||||
|
@ -127,8 +127,9 @@ fi
|
|||
cp -f $CONFIG_FILE /root/tempbackupconfig
|
||||
cp -f $COMPLETION_FILE /root/tempbackupconfig
|
||||
backup_directory_to_friend /root/tempbackupconfig config
|
||||
}
|
||||
|
||||
# Backup user files
|
||||
function backup_users {
|
||||
for d in /home/*/ ; do
|
||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $USERNAME != "git" ]]; then
|
||||
|
@ -198,14 +199,16 @@ for d in /home/*/ ; do
|
|||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Backup Let's Encrypt
|
||||
function backup_letsencrypt {
|
||||
if [ -d /etc/letsencrypt ]; then
|
||||
echo $"Backing up Lets Encrypt settings"
|
||||
backup_directory_to_friend /etc/letsencrypt letsencrypt
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup gnusocial
|
||||
function backup_gnusocial {
|
||||
if grep -q "GNU Social domain" $COMPLETION_FILE; then
|
||||
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
|
||||
if [ -d /var/www/${MICROBLOG_DOMAIN_NAME} ]; then
|
||||
|
@ -218,8 +221,9 @@ if grep -q "GNU Social domain" $COMPLETION_FILE; then
|
|||
exit 6327
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# backup hubzilla
|
||||
function backup_hubzilla {
|
||||
if grep -q "Hubzilla domain" $COMPLETION_FILE; then
|
||||
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}')
|
||||
if [ -d /var/www/${HUBZILLA_DOMAIN_NAME} ]; then
|
||||
|
@ -232,8 +236,9 @@ if grep -q "Hubzilla domain" $COMPLETION_FILE; then
|
|||
exit 2578
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# backup owncloud
|
||||
function backup_owncloud {
|
||||
if [ -d /etc/owncloud ]; then
|
||||
backup_database_to_friend owncloud
|
||||
backup_directory_to_friend /root/tempownclouddata ownclouddata
|
||||
|
@ -241,8 +246,9 @@ if [ -d /etc/owncloud ]; then
|
|||
backup_directory_to_friend /var/lib/owncloud owncloud
|
||||
backup_directory_to_friend /etc/owncloud owncloud2
|
||||
fi
|
||||
}
|
||||
|
||||
# backup gogs
|
||||
function backup_gogs {
|
||||
if [ -d /home/git/go/src/github.com/gogits ]; then
|
||||
backup_database_to_friend gogs
|
||||
backup_directory_to_friend /root/tempgogsdata gogsdata
|
||||
|
@ -254,14 +260,17 @@ if [ -d /home/git/go/src/github.com/gogits ]; then
|
|||
echo $"Obtaining Gogs authorized_keys backup"
|
||||
backup_directory_to_friend /home/git/.ssh gogsssh
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_wiki {
|
||||
if [ -d /etc/dokuwiki ]; then
|
||||
echo $"Backing up wiki"
|
||||
backup_directory_to_friend /var/lib/dokuwiki wiki
|
||||
backup_directory_to_friend /etc/dokuwiki wiki2
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup blog
|
||||
function backup_blog {
|
||||
if grep -q "Blog domain" $COMPLETION_FILE; then
|
||||
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
|
||||
if [ -d /var/www/${FULLBLOG_DOMAIN_NAME} ]; then
|
||||
|
@ -272,32 +281,37 @@ if grep -q "Blog domain" $COMPLETION_FILE; then
|
|||
exit 2578
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup certificates
|
||||
function backup_certs {
|
||||
if [ -d /etc/ssl ]; then
|
||||
echo $"Backing up certificates"
|
||||
backup_directory_to_friend /etc/ssl ssl
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup the public mailing list
|
||||
function backup_mailing_list {
|
||||
if [ -d /var/spool/mlmmj ]; then
|
||||
echo $"Backing up the public mailing list"
|
||||
backup_directory_to_friend /var/spool/mlmmj mailinglist
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup xmpp settings
|
||||
function backup_xmpp {
|
||||
if [ -d /var/lib/prosody ]; then
|
||||
echo $"Backing up the XMPP settings"
|
||||
backup_directory_to_friend /var/lib/prosody xmpp
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup web sites
|
||||
function backup_web_server {
|
||||
if [ -d /etc/nginx ]; then
|
||||
echo $"Backing up web settings"
|
||||
backup_directory_to_friend /etc/nginx/sites-available web
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup admin user README file
|
||||
function backup_admin_readme {
|
||||
if [ -f /home/$ADMIN_USERNAME/README ]; then
|
||||
echo $"Backing up README"
|
||||
if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
|
@ -306,20 +320,23 @@ if [ -f /home/$ADMIN_USERNAME/README ]; then
|
|||
cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
|
||||
backup_directory_to_friend /home/$ADMIN_USERNAME/tempbackup readme
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup IPFS
|
||||
function backup_ipfs {
|
||||
if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
|
||||
echo $"Backing up IPFS"
|
||||
backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup DLNA cache
|
||||
function backup_dlna {
|
||||
if [ -d /var/cache/minidlna ]; then
|
||||
echo $"Backing up DLNA cache"
|
||||
backup_directory_to_friend /var/cache/minidlna dlna
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup VoIP settings
|
||||
function backup_voip {
|
||||
if [ -f /etc/mumble-server.ini ]; then
|
||||
echo $"Backing up VoIP settings"
|
||||
if [ ! -d /root/tempvoipbackup ]; then
|
||||
|
@ -330,8 +347,9 @@ if [ -f /etc/mumble-server.ini ]; then
|
|||
cp -f /etc/sipwitch.conf /root/tempvoipbackup
|
||||
backup_directory_to_friend /root/tempvoipbackup voip
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup Tox node settings
|
||||
function backup_tox {
|
||||
if [ -d /var/lib/tox-bootstrapd ]; then
|
||||
echo "Backing up Tox node settings"
|
||||
if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
|
||||
|
@ -340,8 +358,9 @@ if [ -d /var/lib/tox-bootstrapd ]; then
|
|||
cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd
|
||||
backup_directory_to_friend /var/lib/tox-bootstrapd tox
|
||||
fi
|
||||
}
|
||||
|
||||
# MariaDB settings
|
||||
function backup_mariadb {
|
||||
if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
||||
if [ ! -d /root/tempmariadb ]; then
|
||||
mkdir /root/tempmariadb
|
||||
|
@ -358,6 +377,27 @@ if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
|||
chmod 400 /root/tempmariadb/db
|
||||
backup_directory_to_friend /root/tempmariadb mariadb
|
||||
fi
|
||||
}
|
||||
|
||||
backup_configuration
|
||||
backup_users
|
||||
backup_letsencrypt
|
||||
backup_gnusocial
|
||||
backup_hubzilla
|
||||
backup_owncloud
|
||||
backup_gogs
|
||||
backup_wiki
|
||||
backup_blog
|
||||
backup_certs
|
||||
backup_mailing_list
|
||||
backup_xmpp
|
||||
backup_web_server
|
||||
backup_admin_readme
|
||||
backup_ipfs
|
||||
backup_dlna
|
||||
backup_voip
|
||||
backup_tox
|
||||
backup_mariadb
|
||||
|
||||
# For each remote server
|
||||
while read remote_server
|
||||
|
|
Loading…
Reference in New Issue