Creating a backup of a website directory inside the Web Application Root directory in *nix In CentOS I have a Web Application Root on which I have a website directory.
I would like to make an immediate backup of that website's directory by using the zip utility. The code works and tested.

Although I already use set -x and zipping is verbose (I'm not sure if due to set -x or zip default behavior), the trace is super long and hard to follow - I cant vertically-scroll all of the way top of it through Putty Window in Windows10 Home.
I fear I don't have enough testing to ensure that the file was created, in what size (to assume the size is plausible) and such (maybe just adding ls -la ${war}/mediawiki_general_backups, is enough):

date="$(date +%F-%T)"
war="$HOME/public_html" # Web Application Root
domain="example.com"
zip -r "${war}/mediawiki_general_backups/${domain}-directory-backup-${date}.zip" "${war}/${domain}"
Well, to be honest I am not exactly sure what do you want to review :) This isn't a script. It is just standard zip command.

Maybe you should think about this: ${war}/mediawiki_general_backups/${domain}-directory-backup-${date}.zip. It is too long and ugly. Try to add more these things into your script and a readability will be lost.


  I fear I don't have enough testing to ensure that the file was created,


If you want to be sure, that the zip command finished sucessfully, just test it.

#!/usr/bin/env bash

# Any subsequent(*) commands which fail will cause the shell script to exit immediately.
# https://stackoverflow.com/a/2871034/10814755
# Now i should trust the output of zip command. 
set -e

#domain=$1 &lt;- It could be useful, isn't?
domain="example.com"

#I omit application root. I thing is safer to keep backups away.
backup_path="/mediawiki_backups/${domain}/"
backup_file="$(date +%F-%T).zip"

# You should trust the zip command, but sure is sure.
# So if backup file exist...
# ...and isn't empty...
if [[ -f ${backup_path}${backup_file} ]] &amp;&amp; [[ ! -s ${backup_path}${backup_file} ]]; then
  #... then do something brave :)
else
  echo "Backup failed!"
  exit 1
fi



Regards :)