chg: Exit if remote machine is not available

This commit is contained in:
Sayantan Santra 2024-09-27 16:09:53 -05:00
parent 8563d1c423
commit 31210178f8
Signed by: SinTan1729
GPG Key ID: 0538DD402EA50898
1 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,11 @@ HMDIR="/mnt/storage/sintan"
BKDIR="server-rsync:/mnt/storage"
LGDIR="/home/sintan"
if ! $(ping server-ts -nqc 1 -W 1 >/dev/null 2>&1); then
echo "Remote machine not available. Exiting..."
exit 1
fi
echo $(date) "| Pulling pkglists_server to HDD..." | tee -a "$LGDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$BKDIR/Documents/Backup/pkglists_server/" "$HMDIR/Documents/Backup/pkglists_server/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$LGDIR/TempStorage/impfilesbk.log"