Title: Day 10 - Linux Bash Scripts (media_archive.sh) - Task marked failed despite matching archive contents on both servers

I’m working on the “Day 10: Linux Bash Scripts” task, which requires creating a bash script (media_archive.sh) on App Server 3 that archives /var/www/html/media into xfusioncorp_media.zip, saves it to /archives, and copies it to the Nautilus Storage Server’s /archives directory without a password prompt and without using sudo.

Error received:

archive does not contain correct data on the Storage Server.

What I did:

  1. Installed zip manually (outside the script) using sudo yum install -y zip
  2. Set up passwordless SSH from App Server 3 (banner) to the Storage Server (natasha) using ssh-keygen + ssh-copy-id
  3. Created /scripts/media_archive.sh:

bash

#!/bin/bash

SRC_DIR="/var/www/html/media"
ARCHIVE_NAME="xfusioncorp_media.zip"
ARCHIVE_PATH="/archives/${ARCHIVE_NAME}"

cd "$SRC_DIR" || { echo "Failed to cd into $SRC_DIR"; exit 1; }

zip -r "$ARCHIVE_PATH" .

scp "$ARCHIVE_PATH" natasha@ststor01:/archives/
  1. Made it executable with chmod +x
  2. Ran the script — it completed successfully with no password prompt and no sudo

Verification I did:

  • unzip -l /archives/xfusioncorp_media.zip on App Server 3 shows: index.html (39 bytes), .gitkeep (0 bytes) — 2 files
  • ssh natasha@ststor01 "unzip -l /archives/xfusioncorp_media.zip" on the Storage Server shows the exact same 2 files with matching sizes and timestamps

Despite the archive contents matching exactly on both servers, the task is still marked as failed with “archive does not contain correct data on the Storage Server.”

Question: Is the checker expecting a specific internal structure inside the zip (e.g., the media folder/path preserved inside the archive, rather than the flattened file contents at the zip root)? Any clarification on what the grading script validates would help me correct this.

Screenshot of the failure and terminal output attached.

Try the solution in this post, and see if it helps.

Hi Arpitha,

Your script changes into the media directory and then archives ., so the ZIP only contains the files at its root. Please archive the full source path instead, as shown below:

rm -f /archives/xfusioncorp_media.zip
zip -r /archives/xfusioncorp_media.zip /var/www/html/media
scp /archives/xfusioncorp_media.zip natasha@ststor01:/archives/

Then run the script and submit the task again.

Regards,