diff --git a/bin/setup_backup.sh b/bin/setup_backup.sh index 5ada048..3859bfa 100644 --- a/bin/setup_backup.sh +++ b/bin/setup_backup.sh @@ -1,18 +1,18 @@ #!/bin/bash echo -e "${PURPLE}${BOLD}Enter the receiving server ip : ${RESET}" -read -s receiving_ip +read receiving_ip echo -e "${PURPLE}${BOLD}Enter the receiving server user : ${RESET}" -read -s receiving_user +read receiving_user echo -e "${PURPLE}${BOLD}Enter the receiving server port : ${RESET}" -read -s receiving_port +read receiving_port ssh-keygen ssh-copy-id -p ${receiving_port} ${receiving_user}@${receiving_ip} install_pkg cron -cp ../assets/backup.sh ~/backup.sh +cp ./assets/backup.sh ~/backup.sh chmod +x ~/backup.sh sed -i "s/^receiving_ip=.*/receiving_ip=$receiving_ip/" ~/backup.sh @@ -21,4 +21,4 @@ sed -i "s/^receiving_port=.*/receiving_ip=$receiving_port/" ~/backup.sh cronjob="0 2 * * * ~/backup.sh" -(crontab -l | grep -F ~/backup.sh) && echo "Cron job already exists" || (crontab -l; echo "$cronjob") | crontab - \ No newline at end of file +( crontab -l 2>/dev/null; echo "$cronjob" ) | crontab - \ No newline at end of file