100 days ofdevops; task 10

Hi,
this is my script but don’t work :
#!/bin/bash
yum install zip
zip xfusioncorp_official.zip /var/www/html/official
mkdir -p archives/
cp xfusioncorp_official.zip archives/
ssh-keygen -t rsa
ssh-copy-id tony@stapp01
scp -r archives tony@stapp01:/archives/

Someone could tell me what do to make this script work as expected?

topic :
The production support team of xFusionCorp Industries is working on developing some bash scripts to automate different day to day tasks. One is to create a bash script for archiving website content files. They have a static website running on App Server 2 in Stratos Datacenter, and they need to create a bash script named official_archive.sh which should accomplish the following tasks. (Also remember to place the script under the /scripts directory on App Server 2).

a. Create a zip archive named xfusioncorp_official.zip of /var/www/html/official directory.

b. Save the archive in the /archives/ directory on the App Server 2. This is a temporary storage, as archives from this location will be cleaned on a weekly basis. Therefore, the archive should also be copied to the Nautilus Storage Server so it can be retrieved later for validation purposes.

c. Copy the created archive to the Nautilus Storage Server server in the /archives/ location.

d. Please make sure script won’t ask for password while copying the archive file. Additionally, the respective server user (for example, tony in case of App Server 1) must be able to run it.

Refer to the solution here. This should help you clear this.

Hi @Santosh_KodeKloud
I have used your script but when I submit work. I have found the following message error : “The scripts directory is not find on the server”.
I use mkdir scripts command to create the scripts directory. when I check if it exist I see it. What command you use to create the backup directory in your case ?