Backup and restore nginx password hashes

This commit is contained in:
Bob Mottram 2016-03-06 16:21:00 +00:00
parent 28ce3e0de9
commit b54314d4b0
5 changed files with 19 additions and 0 deletions

View File

@ -9266,6 +9266,7 @@ function install_search_engine {
# an unprivileged user to run as
useradd -d ${SEARCH_ENGINE_PATH}/searx/ -s /bin/false searx
adduser searx debian-tor
# daemon
echo '[Unit]' > /etc/systemd/system/searx.service

View File

@ -451,6 +451,10 @@ function backup_configuration {
if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig
fi
# nginx password hashes
if [ -f /etc/nginx/.htpasswd ]; then
cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd
fi
backup_directory_to_usb /root/tempbackupconfig config
}

View File

@ -172,6 +172,10 @@ function backup_configuration {
if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig
fi
# nginx password hashes
if [ -f /etc/nginx/.htpasswd ]; then
cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd
fi
backup_directory_to_friend /root/tempbackupconfig config
}

View File

@ -295,6 +295,11 @@ function restore_configuration {
fi
fi
# restore nginx password hashes
if [ -f /root/tempconfig/root/htpasswd ]; then
cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd
fi
rm -rf /root/tempconfig
fi
}

View File

@ -205,6 +205,11 @@ function restore_configuration {
fi
fi
# restore nginx password hashes
if [ -f /root/tempconfig/root/htpasswd ]; then
cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd
fi
rm -rf /root/tempconfig
fi
}