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).
xfusioncorp_beta.zip of /var/www/html/beta directory./backup/ on App Server 3. 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./backup/ location.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/
Give the execute permission:
chmod +x /scripts/beta_backup.sh
#!/bin/bash or #!/bin/shset -e to exit on errors"$variable" to prevent word splittingzip -r archive.zip directory/ (cross-platform)tar -czf archive.tar.gz directory/ (Unix standard)