Skip to content

Commit 6e34d74

Browse files
fix code rabbit comments
1 parent fcbbb89 commit 6e34d74

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

devops/linux/docker/backup_restore/dgraph-restore-api.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/bash
22
source ../conf.env
33
#Backup Folder Name
4-
if [ -z "$1" ]; then
5-
echo "Error: No backup folder name provided."
6-
echo "Usage: $0 <backup_folder_name>"
7-
exit 1
8-
fi
4+
if [ -z "$1" ]; then
5+
echo "Error: No backup folder name provided."
6+
echo "Usage: $0 <backup_folder_name>"
7+
exit 1
8+
fi
99
BACKUP_FOLDER_NAME=$1
1010
SCRIPT_DIR=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
11-
cd ${SCRIPT_DIR}/..
11+
cd ${SCRIPT_DIR}/.. || exit
1212
JEMPI_DOCKER_HOME=$PWD
1313
# JEMPI_HOME = $1
1414
down_dir="$JEMPI_DOCKER_HOME/deployment/down"
@@ -20,23 +20,23 @@ fi
2020

2121
# Function to start backup restore API service
2222
start_backup_restore_service() {
23-
pushd "$reboot_dir"
23+
pushd "$reboot_dir" || exit
2424
echo "Starting Backup Restore API service"
2525
source d-stack-start-backup-restore-api-services.sh
26-
popd
26+
popd || exit
2727
}
2828

2929
# Function to stop backup restore API service
3030
stop_backup_restore_service() {
31-
pushd "$down_dir"
31+
pushd "$down_dir" || exit
3232
echo "Stopping Backup Restore API service"
3333
source d-stack-stop-backup-restore-api-services.sh
34-
popd
34+
popd || exit
3535
}
3636

3737
BACKUP_DIR="${DGRAPH_BACKUP_DIRECTORY}/$BACKUP_FOLDER_NAME"
3838
restore_data() {
39-
pushd "$backup_restore_dir"
39+
pushd "$backup_restore_dir" || exit
4040
local dir=$1
4141
echo "$backup_restore_dir"
4242
sleep 20
@@ -45,7 +45,7 @@ restore_data() {
4545
sleep 10
4646
# sudo bash dgraph-backup.sh
4747
# sudo bash postgres-backup.sh
48-
popd
48+
popd || exit
4949
}
5050

5151
start_backup_restore_service

devops/linux/docker/backup_restore/restore-dgraph-postgres.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ while true; do
4040
echo
4141
popd || exit
4242
read -p "Please enter your Backup Folder Name: " BACKUP_FOLDER_NAME
43+
BACKUP_FOLDER_NAME=$(echo $BACKUP_FOLDER_NAME | xargs)
4344

4445
# Check if the folder exists
4546
if [ -d "${DGRAPH_BACKUP_DIRECTORY}/$BACKUP_FOLDER_NAME" ] && [ -d "${POSTGRES_BACKUP_DIRECTORY}/$BACKUP_FOLDER_NAME" ]; then

0 commit comments

Comments
 (0)