From 4dae05ba2c5aa7e367400e50506191088586a529 Mon Sep 17 00:00:00 2001 From: 3err0 Date: Sat, 18 Mar 2023 10:36:13 +0800 Subject: [PATCH] check if rsync installed --- rsync_backup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rsync_backup.sh b/rsync_backup.sh index 98de9af..015eb3b 100644 --- a/rsync_backup.sh +++ b/rsync_backup.sh @@ -19,6 +19,12 @@ delete_archive=true archive_with_date=true #archive_with_date=false +if ! which rsync >/dev/null 2>&1; then + echo "rsync is not installed. Installing..." + sudo apt-get update + sudo apt-get install -y rsync +fi + if [ "$mode" == "files" ]; then rsync -a --exclude-from=$exclude_file --password-file=$password_file $source $user@$ip::$destination else