Skip to content

Commit c33fd59

Browse files
authored
exporting a variable from a child process back to the parent process does not work (#2234)
Signed-off-by: szaimen <szaimen@e.mail.de>
1 parent e73549a commit c33fd59

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

addons/database_shrinking.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ You can find it here: run 'sudo bash $SCRIPTS/menu.sh' -> choose 'Server Configu
3939
then
4040
exit 1
4141
fi
42+
rm -f /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
4243
export SKIP_DAILY_BACKUP_CHECK=1
4344
bash "$DAILY_BACKUP_FILE"
44-
if ! yesno_box_no "Was the backup successfully? If yes, we will start with the database shrinking now."
45+
if ! [ -f "/tmp/DAILY_BACKUP_CREATION_SUCCESSFUL" ]
4546
then
46-
exit 1
47+
if ! yesno_box_no "It seems like the backup was not successful. Do you want to continue nonetheless? (Not recommended!)"
48+
then
49+
exit 1
50+
fi
4751
fi
4852
fi
4953

nextcloud_update.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ then
100100
# Create backup first
101101
if [ -f "$SCRIPTS/daily-borg-backup.sh" ] && does_snapshot_exist "NcVM-snapshot"
102102
then
103+
rm -f /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
103104
export SKIP_DAILY_BACKUP_CHECK=1
104105
bash "$SCRIPTS/daily-borg-backup.sh"
105-
if [ -z "$DAILY_BACKUP_CREATION_SUCCESSFUL" ]
106+
if ! [ -f "/tmp/DAILY_BACKUP_CREATION_SUCCESSFUL" ]
106107
then
107108
notify_admin_gui "Update failed because backup could not be created!" \
108109
"Could not create a backup! $(date +%T)"

not-supported/borgbackup.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,9 @@ Please don't restart or shutdown your server until then!"
584584
remove_log_file
585585
fi
586586

587-
# Export a variable that can be checked for
588-
export DAILY_BACKUP_CREATION_SUCCESSFUL=1
587+
# Create a file that can be checked for
588+
rm -f /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
589+
touch /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
589590

590591
# Exit here if the backup doesn't shall get checked
591592
if [ -z "$CHECK_BACKUP" ]
@@ -705,7 +706,8 @@ else
705706
remove_log_file
706707
fi
707708

708-
# Export a variable that can be checked for
709-
export DAILY_BACKUP_CHECK_SUCCESSFUL=1
709+
# Create a file that can be checked for
710+
rm -f /tmp/DAILY_BACKUP_CHECK_SUCCESSFUL
711+
touch /tmp/DAILY_BACKUP_CHECK_SUCCESSFUL
710712

711713
exit

not-supported/pi-hole.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ notify_admin_gui "Starting the Pi-hole update." "You will be notified when it is
223223
# Create backup first
224224
if [ -f "\$SCRIPTS/daily-borg-backup.sh" ]
225225
then
226+
rm -f /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
226227
export SKIP_DAILY_BACKUP_CHECK=1
227228
bash "\$SCRIPTS/daily-borg-backup.sh"
228-
if [ -z "\$DAILY_BACKUP_CREATION_SUCCESSFUL" ]
229+
if ! [ -f "/tmp/DAILY_BACKUP_CREATION_SUCCESSFUL" ]
229230
then
230231
notify_admin_gui "Pi-hole update failed because backup could not be created!" \
231232
"Could not create a backup! \$(date +%T)"

not-supported/rsyncbackup.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ then
134134
fi
135135

136136
# Check daily backup
137+
rm -f /tmp/DAILY_BACKUP_CHECK_SUCCESSFUL
137138
export SKIP_DAILY_BACKUP_CREATION=1
138139
bash "$SCRIPTS/daily-borg-backup.sh"
139-
if [ -z "$DAILY_BACKUP_CHECK_SUCCESSFUL" ]
140+
if ! [ -f "/tmp/DAILY_BACKUP_CHECK_SUCCESSFUL" ]
140141
then
141142
send_error_mail "Daily backup check failed!" \
142143
"Backup check was unsuccessful! $(date +%T)"

not-supported/system-restore.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ then
113113
then
114114
exit 1
115115
fi
116+
rm -f /tmp/DAILY_BACKUP_CREATION_SUCCESSFUL
116117
export SKIP_DAILY_BACKUP_CHECK=1
117118
bash "$DAILY_BACKUP_FILE"
118-
if ! yesno_box_no "Was the backup successfully? If yes, we will continue with the restore script now."
119+
if ! [ -f "/tmp/DAILY_BACKUP_CREATION_SUCCESSFUL" ]
119120
then
120-
exit 1
121+
if ! yesno_box_no "It seems like the backup was not successful. Do you want to continue nonetheless? (Not recommended!)"
122+
then
123+
exit 1
124+
fi
121125
fi
122126
fi
123127

0 commit comments

Comments
 (0)