Can someone tell me why is wrong with my script. I got error message:
archive does not contain correct data on Backup server.
TASK:
a. Create a zip archive named xfusioncorp_official.zip of /var/www/html/official directory.
b. Save the archive in /backup/ on App Server 2. 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.
if [ $? -eq 0 ]; then
echo “Backup copied to Nautilus Backup Server successfully.”
else
echo “Failed to copy backup to Nautilus Backup Server.”
exit 3
fi
Then, I copied the key to the backup server:
ssh-copy-id [email protected]
After that, I made the script executable:
chmod +x /scripts/official_backup.sh
I ran the script. The ZIP file was created on App Server 2 and successfully copied to the Backup Server. I checked — the files were where they should be.
However, when I submitted the task, I received the following message:
archive does not contain correct data on Backup Server
As I mentioned before, when I ran the script, the file xfusioncorp_official.zip was successfully copied to the stbkp01 server at the path /backup/xfusioncorp_official.zip.
I double-checked everything before clicking submit.
I completed the task using your script. However, if you compare both scripts, they perform the same operations — the only differences are that my version uses variables, checks if directories exist, and includes some additional validations. When I initially ran my script, the files were located on the stbckp01 server, but the task was still marked as incorrect.
Could this be a bug in the system? In any case, we can consider the issue resolved now. @Santosh_KodeKloud thanks for your help!
It could be that when the task fails for the first time and you try it again, the complete variable names are bound to be changed (If copied) according to the new requirement. A mismatch in the vars may be causing the issue.