100-Days-Of-DevOps-Challenge-KodeKloud

Create a BASH Script

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 3 in Stratos Datacenter, and they need to create a bash script named beta_backup.sh which should accomplish the following tasks. (Also remember to place the script under /scripts directory on App Server 3).

Steps

  1. Login into app server 3 and generate ssh-key:
  2. Copy ssh-pub key to backup server. Follow day 07 to complete these two steps
  3. Write the following script in /scripts/beta_backup.sh:

     #!/bin/sh
    
     zip -r /backup/xfusioncorp_beta.zip /var/www/html/beta
     scp /backup/xfusioncorp_beta.zip clint@stbkp01:/backup/
    
  4. Give the execute permission:

     chmod +x /scripts/beta_backup.sh
    

Good to Know?

Bash Scripting Best Practices

Backup Strategies

Archive Commands

Remote Copy Methods