I tried to solve this task more than 10 times, but failed everytime because of the ssh connection between database server(stdb01) and backup server(stbkp01). As you can see Jenkins job console log in below, in the connection stage job stucks while transfering sql.dumb file from db-server to back-up server. I tried two different methods:
-
SSH connection with copying private key directly from DB server to Backup Server with ssh-copy-id and using below command in Jenkins job:
scp -o StrictHostKeyChecking=no db_$(date +%F).sql clint@stbkp01:/home/clint/ db_backups -
Installing sshpass to DB server inside the Jenkins job with below commands:
echo Sp!dy | sudo -S yum install sshpass -y
echo Sp!dy | sudo -S sshpass -p H@wk3y3 scp -o StrictHostKeyChecking=no db_$(date +%F).sql clint@stbkp01:/home/clint/
Both methods not worked. Anybody have any idea?
ScreenShots: