Bash Script Task Review Error -

I did all the steps as asked and the script worked perfectly fine as expected.

Still the system failed to verify the file ‘xfusioncorp_media.zip’ in /backup/ on Backup Server (clint@stbkp01)

Below Fig: To verify myself, I ssh to tony@stapp01 > ssh to clint@stbkp01 > cd /backup > ls > [output: xfusioncorp_media.zip] > I unzipped the file to verify the contents, and everything was there.

I think because of the var dir which came out of the .zip file, the system failed to verify the .zip file and marked my task as ‘Incomplete’.

Here is the link to my review task - KodeKloud Engineer | Real Project Tasks on Real Systems

Please help!!

Hi @avnimahesh your review record isn’t working, so I marked your question as ‘Validation Error’.

Thanks,
KodeKloud Support

Thank you so much @Vitor for responding and the help.

So by ‘review record isn’t working’, you mean there was a technical issue, right?

Also, what would be the next step in this? I mean how can I retry the task?

Let me know.

Thanks & regards,
Avni Maheshwari

All tasks are recorded, so we can review them. Keep going through the tasks and this task will appear again, don’t worry. :slight_smile:

Thanks,
KodeKloud Support

Oh! I see.
Alright! I will wait for another task to assign.

Thanks again for your support.

Hi @Vitor .

Today I got this task again and it failed me again.

It seems that there is some problem in the task review algorithm or whatever it is called.

After running my script, I logged out of the AppServer 3 and logged In to the Nautilus Backup server to verify the file and, it was right there.
Then I clicked on the Check Task button and it failed me.

I don’t understand what is happening. Even if I put a Request Review on the task, there is no sense because the Task verification system has gone haywire.

Please look into this.

@Tej-Singh-Rana
Hi Tej,
If possible please check the reason behind this.

Thanks & regards,
Avni Maheshwari

Hi @avnimahesh ,
Can you please share the review link? btw don’t worry about the points. If it’s a validation issue then I will mark pending for you. But at least give us the chance to review it.

Regards,
KodeKloud Support

Sure @Tej-Singh-Rana .

Here is the Review link to the task - KodeKloud Engineer | Real Project Tasks on Real Systems

I do not worry about the points, its just that I am getting confused if I am performing the task correctly or not.
Also, thank you for doing this for me.

Thanks & regards,
Avni Maheshwari

Hi @avnimahesh ,
You are doing it correctly but we are expecting this from the sudo user, not from the root user of app server3.
Did you read this line?

Please make sure the script won't ask for a password while copying the archive file. Additionally, the respective server user (for example, tony in the case of App Server 1) must be able to run it.

You should have to run that script from the banner user and without interruption.

Regards,
KodeKloud Support

@Tej-Singh-Rana

Okay. So yes, I created and ran the script from the root user on App Server 3 but it is not mentioned anywhere in the question to perform the tasks with the Normal user only. So even if the files that I created have a root ownership but I have added ‘rwx’ permission for other users as well. So anybody could access those files.

For the script to not ask for password, I did the following before running the script:

  1. ssh keygen (Generated keygen for App Server 3)
  2. ssh-copy-id clint@stbkp01 (Copied the keygen to Nautilus Backup server)

After all these things, I logged out of App S 3 and logged in to Nautilus backup server to check for the file, and it was there.
Then I logged out of the Backup Server and logged in as tony@stapp01 to check if tony is able to access and run the files, and he was but the task kept failing me.

Let me know where I am wrong in this.

Thanks & regards,
Avni Maheshwari

image-421

Yes @Tej-Singh-Rana
I read point number d. very carefully and the commands I used, allows the script to run and execute successfully without asking for the password.
Now let me know if you have a solution or a rectification of this problem.
My steps are correct and I’m confident about it.

Hi again.

Is there something happening at the back-end?

I haven’t received any task in the past 72+ hours.

Hi,
Sorry for the delayed response.
So banner user also can run that script without facing any permission issues?
btw I marked this task pending for you. Please try from the sudo user.
Give it a try and let me know.

Regards,

Do the same steps again from the root user and make the script executable and after that run it from the sudo user of that app server (Example:- app server01, it’s tony).
Let me know if you are able to run the script successfully.

Regards,

Hi @Tej-Singh-Rana

I did all the steps even verified the zip archive on my own but the task failed still.

Here is what I did:

Logged -in to App Server 01 - ssh tony@stapp01

Changed to root user - sudo -i and then performed the below steps.

  1. Created the script in /scripts on App Server 1 - vi touch /script/news_backup.sh

Commands in the script:
zip /backup/xfusioncorp_news.zip -r /var/www/html/news
scp /backup/xfusioncorp_news.zip clint@stbkp01:/backup

  1. Made the script executable - chmod +x /script/news_backup.sh
  2. Generated ssh keygen and copied keygen to Nautilus Backup server so that the script won’t ask for password - a) ssh-keygen b) ssh-copy-id clint@stbkp01
  3. Finally, ran the script - sh /script/news_backup.sh

VERIFICATION

  1. Logged in to App Server 3 to check if he is able to execute the .zip file or not - ssh banner@stapp03
  2. Then ssh into Nautilus Backup server from App Server 3 - ssh clint@stbkp01
  3. Changed the directory to /backup to access .zip file - cd /backup

Below image shows points 1, 2 and 3:

  1. Checked if zip package is installed or not - rpm -q zip
  2. Installed zip using YUM - sudo yum install zip -y
  3. Unzipped the .zip file, changed into /var/www/html/news dir and cat the output of index.html -
    a) unzip xfusioncorp_news.zip b) cd /var/www/html/news c) cat index.html
    → Output of index.html
  4. I also deleted the var dir from /backup so that the task may not fail again - rm -rf var/

Below image shows points 5,6, and 7.

Logged out of App Server 3 and clicked on the Check Task button.

See below image -

Did you run the script from the tony user? Did it work?

Oh god! If Banner user on App Server 3 is able to run the file, tony user will have no problems at all in running, extracting or unzipping the file.

I added an executable (x) permission for others on the .zip file which means, other than File owner and group owner, other people could also access and open the file.

I don’t know what is being so hard to understand, my steps or the fault in KodeKloud’s system.

I am checking with the given steps. I will share updates after some time.

Regards,

Please find the attached screenshot.