Also, I think some parts of my code don't even work properly. I am sure there are much more elegant solutions to approach my problem. Sshpass -p my_server_y_password ssh -p "my_server_x_password" scp server_y/file/pathĪnd, after this, I should run my script * * 20 * * my_bash_script.sh # somehow check if file from server_x exists (currently I don't know how to do it on a different server) Some Advantages and Features of Rsync Command. You don’t need to be a root user to run the rsync command. This article explains 10 basic and advanced usage of the rsync command to transfer your files remotely and locally in Linux-based machines. At the same time, SFTP allows you to continue an interrupted file transfer. Rsync Local and Remote File Synchronization. Port: leave it blank Protocol: SFTP - SSH File Transfer Protocol Logon Type: Ask for password User: Your. I think that the code should look like (inside my_bash_script.sh) year_month="$(date +'%Y%m')" You can not resume an interrupted file transfer with SCP. Copy files with SFTP Host: the FQDN of your VM. If the file does not exist, it shouldn't do anything I want to get this code to run on 20th of every month and also use the YYYYMM date format for searching the file. Currently I follow the following steps for copying a file from server_x to server_y (Let's suppose I run this code on 20th April 2021 = 202104) sshpass -p "my_server_y_password" ssh -p "my_server_x_password" scp server_y/file/path
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |