Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NFS4SERVER improvements to the wording and more defensive coding
and fixing typo
- Loading branch information
Showing
1 changed file
with
9 additions
and
12 deletions.
There are no files selected for viewing
21 changes: 9 additions & 12 deletions
21
usr/share/rear/restore/NFS4SERVER/default/400_restore_with_nfs_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
# 400_restore_with_nfs_server.sh | ||
|
||
local check_file="$TARGET_FS_ROOT/$NFS4SERVER_RESTORE_FINISHED_FILE" | ||
local check_file="$TARGET_FS_ROOT/$NFS4SERVER_RESTORE_FINISHED_FILE" nfs_connections used_space | ||
|
||
LogPrint "Mount the nfs share: 'mount -t nfs <ip>:/ <destination>' and restore all files to mounted destination." | ||
LogPrint "Create the $check_file file when the restore is completed and umount the share." | ||
LogPrint "Create the <destination>/$NFS4SERVER_RESTORE_FINISHED_FILE file when the restore is completed and umount the share." | ||
|
||
rm -f $check_file || Error "Couldn't delete restore finished file $check_file" | ||
rm -f "$check_file" || Error "Couldn't delete restore finished file $check_file" | ||
|
||
LogPrint "Wait until $check_file was created and there is no connection on the NFS-Port 2049." | ||
LogPrint "Waiting until $check_file was created and there is no connection on the NFS-Port 2049." | ||
|
||
# or look at /var/lib/nfs/rmtab | ||
local nfs_connections=1 | ||
nfs_connections=1 | ||
while [ ! -f "$check_file" ] || [ "$nfs_connections" -gt 0 ]; do | ||
local used_space | ||
used_space=$(df --total --local -h --exclude-type=tmpfs --exclude-type=devtmpf | tail -n 1 | awk '{print $3}') && | ||
used_space=$( | ||
df --total --local -h --exclude-type=tmpfs --exclude-type=devtmpfs | awk 'END{print $3}' | ||
) && \ | ||
ProgressInfo " Used storage space: $used_space" | ||
|
||
sleep 5 | ||
nfs_connections=$(ss -tanpH state established "( sport = 2049 )" | wc -l) | ||
done | ||
|
||
rm -f $check_file || Error "Couldn't delete restore finished file $check_file" | ||
rm -f "$check_file" || Error "Couldn't delete restore finished file $check_file" |