Owncloud remote restore
This commit is contained in:
parent
756c1c32e9
commit
4c853944e1
|
@ -699,13 +699,14 @@ function restore_owncloud {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
OWNCLOUD_PATH=/var/www/owncloud
|
OWNCLOUD_PATH=/var/www/owncloud
|
||||||
if grep -q "Owncloud domain" $COMPLETION_FILE; then
|
if grep -q "Owncloud domain" $COMPLETION_FILE; then
|
||||||
OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
|
OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
|
||||||
restore_database_from_friend owncloud $OWNCLOUD_DOMAIN_NAME
|
restore_database_from_friend owncloud $OWNCLOUD_DOMAIN_NAME
|
||||||
|
|
||||||
if [ -d $SERVER_DIRECTORY/backup/owncloudfiles ]; then
|
if [ -d $SERVER_DIRECTORY/backup/owncloudfiles ]; then
|
||||||
echo $"Restoring Owncloud installation"
|
echo $"Restoring Owncloud installation"
|
||||||
|
restore_directory_from_friend /root/tempowncloudfiles owncloudfiles
|
||||||
cp -r /root/tempowncloudfiles/* /
|
cp -r /root/tempowncloudfiles/* /
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 1458
|
exit 1458
|
||||||
|
@ -715,6 +716,7 @@ function restore_owncloud {
|
||||||
|
|
||||||
if [ -d $SERVER_DIRECTORY/backup/owncloudconfig ]; then
|
if [ -d $SERVER_DIRECTORY/backup/owncloudconfig ]; then
|
||||||
echo $"Restoring Owncloud installation"
|
echo $"Restoring Owncloud installation"
|
||||||
|
restore_directory_from_friend /root/tempowncloudconfig owncloudconfig
|
||||||
cp -r /root/tempowncloudconfig/* /
|
cp -r /root/tempowncloudconfig/* /
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 2571
|
exit 2571
|
||||||
|
@ -723,16 +725,16 @@ function restore_owncloud {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R www-data:www-data $OWNCLOUD_PATH
|
chown -R www-data:www-data $OWNCLOUD_PATH
|
||||||
chown root:root $OWNCLOUD_PATH/config/config.php
|
chown root:root $OWNCLOUD_PATH/config/config.php
|
||||||
|
|
||||||
# re-index files
|
# re-index files
|
||||||
for d in /home/*/ ; do
|
for d in /home/*/ ; do
|
||||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||||
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
||||||
$OWNCLOUD_PATH/occ files:scan $USERNAME
|
$OWNCLOUD_PATH/occ files:scan $USERNAME
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_mediagoblin {
|
function restore_mediagoblin {
|
||||||
|
@ -745,246 +747,246 @@ function restore_mediagoblin {
|
||||||
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
|
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
|
||||||
if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
|
if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
|
||||||
echo $"Restoring Mediagoblin installation"
|
echo $"Restoring Mediagoblin installation"
|
||||||
restore_directory_from_friend /root/tempmediagoblin mediagoblin
|
restore_directory_from_friend /root/tempmediagoblin mediagoblin
|
||||||
cp -r /root/tempmediagoblin/* /
|
cp -r /root/tempmediagoblin/* /
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 5626
|
exit 5626
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempmediagoblin
|
rm -rf /root/tempmediagoblin
|
||||||
fi
|
fi
|
||||||
chown -hR mediagoblin:www-data /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
chown -hR mediagoblin:www-data /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_gogs {
|
function restore_gogs {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'gogs' ]]; then
|
if [[ $RESTORE_APP != 'gogs' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if grep -q "Gogs domain" $COMPLETION_FILE; then
|
if grep -q "Gogs domain" $COMPLETION_FILE; then
|
||||||
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
|
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
|
||||||
restore_database_from_friend gogs $GIT_DOMAIN_NAME
|
restore_database_from_friend gogs $GIT_DOMAIN_NAME
|
||||||
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
|
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
|
||||||
if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
|
if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
|
||||||
mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
|
mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
|
||||||
fi
|
fi
|
||||||
cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom/
|
cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 5885
|
exit 5885
|
||||||
fi
|
fi
|
||||||
echo $"Restoring Gogs repos"
|
echo $"Restoring Gogs repos"
|
||||||
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
||||||
cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
|
cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 7649
|
exit 7649
|
||||||
fi
|
fi
|
||||||
echo $"Restoring Gogs authorized_keys"
|
echo $"Restoring Gogs authorized_keys"
|
||||||
restore_directory_from_friend /root/tempgogsssh gogsssh
|
restore_directory_from_friend /root/tempgogsssh gogsssh
|
||||||
if [ ! -d /home/git/.ssh ]; then
|
if [ ! -d /home/git/.ssh ]; then
|
||||||
mkdir /home/git/.ssh
|
mkdir /home/git/.ssh
|
||||||
fi
|
fi
|
||||||
cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
|
cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 74239
|
exit 74239
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempgogs
|
rm -rf /root/tempgogs
|
||||||
rm -rf /root/tempgogsrepos
|
rm -rf /root/tempgogsrepos
|
||||||
rm -rf /root/tempgogsssh
|
rm -rf /root/tempgogsssh
|
||||||
chown -R git:git /home/git
|
chown -R git:git /home/git
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_wiki {
|
function restore_wiki {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'wiki' ]]; then
|
if [[ $RESTORE_APP != 'wiki' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
|
if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
|
||||||
WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
|
WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
|
||||||
echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
|
echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
|
||||||
restore_directory_from_friend /root/tempwiki wiki
|
restore_directory_from_friend /root/tempwiki wiki
|
||||||
cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
|
cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 868
|
exit 868
|
||||||
fi
|
fi
|
||||||
restore_directory_from_friend /root/tempwiki2 wiki2
|
restore_directory_from_friend /root/tempwiki2 wiki2
|
||||||
cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
|
cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 869
|
exit 869
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempwiki
|
rm -rf /root/tempwiki
|
||||||
rm -rf /root/tempwiki2
|
rm -rf /root/tempwiki2
|
||||||
chown -R www-data:www-data /var/lib/dokuwiki/*
|
chown -R www-data:www-data /var/lib/dokuwiki/*
|
||||||
# Ensure that the bundled SSL cert is being used
|
# Ensure that the bundled SSL cert is being used
|
||||||
if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
|
if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
|
||||||
sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
|
sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
|
if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
|
||||||
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
|
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
|
||||||
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
|
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_blog {
|
function restore_blog {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'blog' ]]; then
|
if [[ $RESTORE_APP != 'blog' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/blog ]; then
|
if [ -d $SERVER_DIRECTORY/backup/blog ]; then
|
||||||
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
|
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
|
||||||
echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
|
echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
|
||||||
mkdir /root/tempblog
|
mkdir /root/tempblog
|
||||||
restore_directory_from_friend /root/tempblog blog
|
restore_directory_from_friend /root/tempblog blog
|
||||||
rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
|
rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
|
||||||
cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
|
cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 593
|
exit 593
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempblog
|
rm -rf /root/tempblog
|
||||||
if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
|
if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
|
||||||
echo $"No content directory found after restoring blog"
|
echo $"No content directory found after restoring blog"
|
||||||
exit 287
|
exit 287
|
||||||
fi
|
fi
|
||||||
# Ensure that the bundled SSL cert is being used
|
# Ensure that the bundled SSL cert is being used
|
||||||
if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
|
if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
|
||||||
sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
|
sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
|
||||||
fi
|
fi
|
||||||
for d in /home/*/ ; do
|
for d in /home/*/ ; do
|
||||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||||
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
||||||
if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
|
if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
|
||||||
mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
|
mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
|
if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
|
||||||
ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
|
ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
|
||||||
ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
|
ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_cjdns {
|
function restore_cjdns {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'cjdns' ]]; then
|
if [[ $RESTORE_APP != 'cjdns' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/cjdns ]; then
|
if [ -d $SERVER_DIRECTORY/backup/cjdns ]; then
|
||||||
echo $"Restoring cjdns installation"
|
echo $"Restoring cjdns installation"
|
||||||
restore_directory_from_friend /root/tempcjdns cjdns
|
restore_directory_from_friend /root/tempcjdns cjdns
|
||||||
rm -rf /etc/cjdns
|
rm -rf /etc/cjdns
|
||||||
cp -r /root/tempcjdns/etc/cjdns /etc/
|
cp -r /root/tempcjdns/etc/cjdns /etc/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 7438
|
exit 7438
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempcjdns
|
rm -rf /root/tempcjdns
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_voip {
|
function restore_voip {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'voip' ]]; then
|
if [[ $RESTORE_APP != 'voip' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/voip ]; then
|
if [ -d $SERVER_DIRECTORY/backup/voip ]; then
|
||||||
echo $"Restoring VoIP settings"
|
echo $"Restoring VoIP settings"
|
||||||
restore_directory_from_friend /root/tempvoip voip
|
restore_directory_from_friend /root/tempvoip voip
|
||||||
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
rm -rf /root/tempvoip
|
rm -rf /root/tempvoip
|
||||||
exit 7823
|
exit 7823
|
||||||
fi
|
fi
|
||||||
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
rm -rf /root/tempvoip
|
rm -rf /root/tempvoip
|
||||||
exit 7823
|
exit 7823
|
||||||
fi
|
fi
|
||||||
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
rm -rf /root/tempvoip
|
rm -rf /root/tempvoip
|
||||||
exit 276
|
exit 276
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempvoip
|
rm -rf /root/tempvoip
|
||||||
cp /etc/ssl/certs/mumble* /var/lib/mumble-server
|
cp /etc/ssl/certs/mumble* /var/lib/mumble-server
|
||||||
cp /etc/ssl/private/mumble* /var/lib/mumble-server
|
cp /etc/ssl/private/mumble* /var/lib/mumble-server
|
||||||
chown -R mumble-server:mumble-server /var/lib/mumble-server
|
chown -R mumble-server:mumble-server /var/lib/mumble-server
|
||||||
service sipwitch restart
|
service sipwitch restart
|
||||||
service mumble-server restart
|
service mumble-server restart
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_tox {
|
function restore_tox {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'tox' ]]; then
|
if [[ $RESTORE_APP != 'tox' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d $SERVER_DIRECTORY/backup/tox ]; then
|
if [ -d $SERVER_DIRECTORY/backup/tox ]; then
|
||||||
echo $"Restoring Tox node settings"
|
echo $"Restoring Tox node settings"
|
||||||
restore_directory_from_friend / tox
|
restore_directory_from_friend / tox
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 93653
|
exit 93653
|
||||||
fi
|
fi
|
||||||
cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
|
cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
|
||||||
systemctl restart tox-bootstrapd.service
|
systemctl restart tox-bootstrapd.service
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
systemctl status tox-bootstrapd.service
|
systemctl status tox-bootstrapd.service
|
||||||
exit 59369
|
exit 59369
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_email {
|
function restore_email {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'email' ]]; then
|
if [[ $RESTORE_APP != 'email' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
for d in $SERVER_DIRECTORY/backup/mail/*/ ; do
|
for d in $SERVER_DIRECTORY/backup/mail/*/ ; do
|
||||||
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
|
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
|
||||||
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
|
||||||
if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then
|
if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then
|
||||||
if [ ! -d /home/$USERNAME ]; then
|
if [ ! -d /home/$USERNAME ]; then
|
||||||
${PROJECT_NAME}-adduser $USERNAME
|
${PROJECT_NAME}-adduser $USERNAME
|
||||||
fi
|
fi
|
||||||
echo $"Restoring emails for $USERNAME"
|
echo $"Restoring emails for $USERNAME"
|
||||||
restore_directory_from_friend /root/tempmail mail/$USERNAME
|
restore_directory_from_friend /root/tempmail mail/$USERNAME
|
||||||
if [ ! -d /home/$USERNAME/Maildir ]; then
|
if [ ! -d /home/$USERNAME/Maildir ]; then
|
||||||
mkdir /home/$USERNAME/Maildir
|
mkdir /home/$USERNAME/Maildir
|
||||||
fi
|
fi
|
||||||
tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 927
|
exit 927
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempmail
|
rm -rf /root/tempmail
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_dlna {
|
function restore_dlna {
|
||||||
if [[ $RESTORE_APP != 'all' ]]; then
|
if [[ $RESTORE_APP != 'all' ]]; then
|
||||||
if [[ $RESTORE_APP != 'dlna' ]]; then
|
if [[ $RESTORE_APP != 'dlna' ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d /var/cache/minidlna ]; then
|
if [ -d /var/cache/minidlna ]; then
|
||||||
if [ -d $SERVER_DIRECTORY/backup/dlna ]; then
|
if [ -d $SERVER_DIRECTORY/backup/dlna ]; then
|
||||||
echo $"Restoring DLNA cache"
|
echo $"Restoring DLNA cache"
|
||||||
restore_directory_from_friend /root/tempdlna dlna
|
restore_directory_from_friend /root/tempdlna dlna
|
||||||
cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
|
cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 982
|
exit 982
|
||||||
fi
|
fi
|
||||||
rm -rf /root/tempdlna
|
rm -rf /root/tempdlna
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Social key management
|
# Social key management
|
||||||
|
|
Loading…
Reference in New Issue