hello
your line q-a should also be in your script you had to create zip file through script not separately
bot of your lines Q-a & Q-3 should have been in script
Can i get that script new_backup.sh i m finding it hard to uderstand
what didn’t you get precisely ???
yes, i already dit that, after reviewing, i think that i needed to copy keyid to stbkp01 from banner user not from root, therefore avoiding script asks for password while copying backup to stbkp
Like what all commands u used inside the script to take back up and all
@Akshay First of all you need to make a cmd that create a zip file and save it in / backup
So you should install zip package by running the cmd bellow:
Yum install -y zip unzip
After that, create the necessary zip file bu running
zip -r path-of-your-backp-file path-of-dir-you-would-to-take-back-of
In my case it is
Zip /backup/xfusion…zip /var/www/html/xxxx
The second cmd permit to copy that file from the web server to the backup server
Scp source destination
In this case it is
Scp /backup/xfus…zip clint@stbkp01:/backup/xfus…zip
using theses two commands will allow to you, to create your own script under /scripts/name-of-your-script.sh
any script should begin by #!/bin/bash and remenber thats cmds will run from the top first sd 3th …etc
furthermore, to make the script run without asking for password of clint user user in the second cmd, we need to generate a key and copy that key on stbkp server so try to follow these cmds :
ssh-keygen
ssh-copy-id clint@stbkp01
So in that step you will almost finish you must just run you script and check the destination dir that it contains backup files
To run script
Sh /scripts/script-name
Good luck
Hi Team,
Although,created bash script worked fine and copied zip file over backup server but still i got failed remark.
Kindly find an enclosed attached snapshot for your perusal.
Could you please check and do the needful.
because we don’t need to use tar archive, we need to use zip command.
tar cvzf
creates gz2 something extention not zip.
@prashantj.jadhav26
you must use zip command to create zip archive
thank you so much
@Tej-Singh-Rana
@peterwhite
@yelmir
hi all,
as part of this task. I first ran these commands on stbkp01 server as a normal user.
on stapp02 server. I created this bash script.
this is the message I get finally.
on stapp02 the file is copied.
when I verify the backup folder in stbkp01, the file is not copied there.
let me know the mistake I am doing. thank you
Hello, @swaroopcs88
Read the below article and try to apply. You have to bypass that “yes/no” prompt.
@Tej-Singh-Rana
Hi Tej,
I am trying these commands will this work.
on stbkp01 server. I ran ssh-keygen
on stapp01, I created this bash script and trying to execute it.
Please check and advise. thank you
Though the zip files are getting copied to application server and backup server.
however, I am prompted for user password. so somewhere I am going wrong.
Hi @swaroopcs88,
Take a look at What is ssh-copy-id? How ssh-copy-id works? - that should help you resolve the problem…
Best,
Peter
You don’t need to add yum install zip unzip just remove that as zip binary is already available .
Just add this lines in script:
#!/bin/bash
zip -r /backup/xfusioncorp_beta.zip /var/www/html/beta
scp /backup/xfusioncorp_beta.zip clint@stbkp01:/backup/
And do $ ssh-keygen and $ssh-copy-id clint@stbkp01 manually
Add name of the files as per task
@akshayyw @Tej-Singh-Rana @Inderpreet and others,
task failed with below error though i m sure about my steps.
Steps followed are as below:
-
created script in stapp01
-
on stapp01
ssh-keygen
ssh-copy-id clint@stbkp01
was able to login to stbkp01 from stapp01 without any password -
when ran script can see zip file in both stapp01 /backup folder as well as stbkp01 /backup folder.
Please assist me in getting it right.
Thanks in adavce.
Regards,
Yogendra
Hello, @yogendra
I think you have to perform this task from respective sudo user of the app server. You are in the app server 1 so should be tony not root.
you were right i got succeeded now by doing it as respective sudo users. Thanks much.
Regards,
Yogendra