update restore script
This commit is contained in:
parent
50a3c62c28
commit
32c2d42efb
|
@ -119,9 +119,13 @@ Create same linux user account as old server and add to sudoers group and setup
|
|||
|
||||
Copy backup file to new server
|
||||
|
||||
Download and run the restore script, passing it the backup tar file as the first argument
|
||||
Download the restore script, and edit the postgres username/password at the top of the file. Same instructions as above in the backup steps.
|
||||
```
|
||||
wget https://raw.githubusercontent.com/wh1te909/tacticalrmm/develop/restore.sh
|
||||
```
|
||||
|
||||
Run the restore script, passing it the backup tar file as the first argument
|
||||
```
|
||||
chmod +x restore.sh
|
||||
./restore.sh rmm-backup-xxxxxxx.tar
|
||||
```
|
||||
|
|
18
restore.sh
18
restore.sh
|
@ -1,6 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_VERSION="3"
|
||||
#####################################################
|
||||
|
||||
pgusername="changeme"
|
||||
pgpw="hunter2"
|
||||
|
||||
#####################################################
|
||||
|
||||
SCRIPT_VERSION="4"
|
||||
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/develop/restore.sh'
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
|
@ -22,6 +29,12 @@ fi
|
|||
|
||||
rm -f $TMP_FILE
|
||||
|
||||
if [[ "$pgusername" == "changeme" || "$pgpw" == "hunter2" ]]; then
|
||||
printf >&2 "${RED}You must change the postgres username/password at the top of this file.${NC}\n"
|
||||
printf >&2 "${RED}Check the github readme for where to find them.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UBU20=$(grep 20.04 "/etc/"*"release")
|
||||
if ! [[ $UBU20 ]]; then
|
||||
echo -ne "\033[0;31mThis restore script will only work on Ubuntu 20.04\e[0m\n"
|
||||
|
@ -161,9 +174,6 @@ sleep 2
|
|||
|
||||
print_green 'Restoring the database'
|
||||
|
||||
pgusername=$(grep -A 6 DATABASES $tmp_dir/rmm/local_settings.py | grep USER | tr -d " \t" | sed 's/.*://' | tr -d "',")
|
||||
pgpw=$(grep -A 6 DATABASES $tmp_dir/rmm/local_settings.py | grep PASSWORD | tr -d " \t" | sed 's/.*://' | tr -d "',")
|
||||
|
||||
sudo -u postgres psql -c "DROP DATABASE IF EXISTS tacticalrmm"
|
||||
sudo -u postgres psql -c "CREATE DATABASE tacticalrmm"
|
||||
sudo -u postgres psql -c "CREATE USER ${pgusername} WITH PASSWORD '${pgpw}'"
|
||||
|
|
Loading…
Reference in New Issue