Skip to content

Commit d02d77a

Browse files
committed
minor restore script changes
1 parent bf5cbab commit d02d77a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mycodo/scripts/mycodo_backup_restore.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ elif [ ! -d "$1" ]; then
1515
exit 2
1616
fi
1717

18-
INSTALL_DIRECTORY=$( cd -P /var/mycodo-root/.. && pwd -P )
18+
INSTALL_DIRECTORY="/opt"
1919
echo '1' > "${INSTALL_DIRECTORY}"/Mycodo/.restore
2020

2121
function error_found {
@@ -27,16 +27,17 @@ function error_found {
2727
exit 1
2828
}
2929

30+
cd /
31+
3032
CURRENT_VERSION=$("${INSTALL_DIRECTORY}"/Mycodo/env/bin/python "${INSTALL_DIRECTORY}"/Mycodo/mycodo/utils/github_release_info.py -c 2>&1)
3133
NOW=$(date +"%Y-%m-%d_%H-%M-%S")
3234
BACKUP_DIR="/var/Mycodo-backups/Mycodo-backup-${NOW}-${CURRENT_VERSION}"
3335

3436
printf "\n#### Restore of backup %s initiated %s ####\n" "$1" "$NOW"
3537

36-
printf "#### Stopping Daemon and HTTP server ####\n"
38+
printf "#### Stopping backend and frontend ####\n"
3739
service mycodo stop
38-
sleep 2
39-
apachectl stop
40+
service mycodoflask stop
4041

4142
/bin/bash "${INSTALL_DIRECTORY}"/Mycodo/mycodo/scripts/upgrade_commands.sh initialize
4243

@@ -85,6 +86,8 @@ if ! "${INSTALL_DIRECTORY}"/Mycodo/mycodo/scripts/upgrade_commands.sh update-per
8586
error_found
8687
fi
8788

89+
service mycodoflask restart
90+
8891
printf "\n\nRunning post-restore script...\n"
8992
if ! "${INSTALL_DIRECTORY}"/Mycodo/mycodo/scripts/upgrade_post.sh ; then
9093
printf "Failed: Error while running post-restore script.\n"

0 commit comments

Comments
 (0)