Linux Bash Scripts not OK

The request was :slight_smile:
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 taking websites backup. They have a static website running on App Server 1 in Stratos Datacenter, and they need to create a bash script named media_backup.sh which should accomplish the following tasks. (Also remember to place the script under /scripts directory on App Server 1)

a. Create a zip archive named xfusioncorp_media.zip of /var/www/html/media directory.

b. Save the archive in /backup/ on App Server 1. This is a temporary storage, as backups from this location will be clean on weekly basis. Therefore, we also need to save this backup archive on Nautilus Backup Server.

c. Copy the created archive to Nautilus Backup Server server in /backup/ 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.

The problem seems to be in the backup server

my script contained :

#!/bin/bash
zip -r /backup/xfusioncorp_media.zip /var/www/html/media
scp /backup/xfusioncorp_media.zip clint@stbkp01:/backup/

Could you please bring some light in this¿?

Thanks.

Hi

In the script basically you are doing part a in 1st line and part b in 2nd line

scp will take care of part d for runing this wihotut password so you need to make sure password les authentication has been done prior to executing this script.

@fst_eng, please make sure, you configure paswordless access from respective sudo user i.e tony for App Server 1