corrections setup backup

This commit is contained in:
Valentin 2024-05-31 12:48:23 +02:00
parent dbb04e66af
commit 3315d32b3a
1 changed files with 5 additions and 5 deletions

View File

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
echo -e "${PURPLE}${BOLD}Enter the receiving server ip : ${RESET}" 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}" 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}" echo -e "${PURPLE}${BOLD}Enter the receiving server port : ${RESET}"
read -s receiving_port read receiving_port
ssh-keygen ssh-keygen
ssh-copy-id -p ${receiving_port} ${receiving_user}@${receiving_ip} ssh-copy-id -p ${receiving_port} ${receiving_user}@${receiving_ip}
install_pkg cron install_pkg cron
cp ../assets/backup.sh ~/backup.sh cp ./assets/backup.sh ~/backup.sh
chmod +x ~/backup.sh chmod +x ~/backup.sh
sed -i "s/^receiving_ip=.*/receiving_ip=$receiving_ip/" ~/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" cronjob="0 2 * * * ~/backup.sh"
(crontab -l | grep -F ~/backup.sh) && echo "Cron job already exists" || (crontab -l; echo "$cronjob") | crontab - ( crontab -l 2>/dev/null; echo "$cronjob" ) | crontab -