1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 20:58:37 -06:00

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

View file

@ -73,6 +73,11 @@ HMDIR="/mnt/storage/sintan"
BKDIR="server-rsync:/mnt/storage" BKDIR="server-rsync:/mnt/storage"
LGDIR="/home/sintan" 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" 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" 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" echo $'\n'$(date) "| Done!" | tee -a "$LGDIR/TempStorage/impfilesbk.log"