Day 10: Linux Bash Scripts - Unexpected error




Please watch my screenshots that I have taken. It shows you some unbelievable errors. Sometimes it shows me that I did not have a backup file directory, but I already created one.

When I try to list down scripts and backup directories from the root account, it shows me nothing. Is that possible?

The lab session gave me this kind of error -

  • ‘beta_backup.sh’ not found under ‘/scripts’ on App Server 2

But I double-check that I created the scripts/ directory

Can someone tell me I did do something wrong, and what it is that?

I am so confused, and I do not know what to do. Please help me.

The first thing I noticed is you have created the scripts and backup directories inside the user steve’s home directory. In this task you don’t have to do so. Both directories are already created inside the root directory. You can see that by changing to the root directory(not the root user’s home directory) by cd / and then see the content by cd -l. In Linux there are two type of paths. The absolute path and the relative path. The absolute path always begin with the root directory denoted by the forward slash at the begining(/backup, /scripts etc). The relative path is the path related to the current working directory.

Another thing is in your bash script, for the scp command you have given the path of the backup zip as backup/xfusioncorp_beta.zip. Instead give the path from the root /backup/xfusioncorp_beta.zip (You have missed the forward slash before the backup).

Also, I would like to mention that you should use the private and public key pairs to log into the backup server without entering the password as required in the task. You can do it by using ssh-keygen and ssh-copy-id commands. You can find how to do it in the internet. If you face any further difficulties, I’m happy to help. Wishing you the best of luck!

1 Like

Vidusha, Thank you for your valuable reply. I misunderstood file directories and I learned that. As your reply, root and home directory were the problem. After studying your reply, I did it again, step by step, carefully. And it worked!.

Thank you so much again. You made my day!

1 Like

You’re welcome Suraj! Glad it worked out and happy to hear my reply helped. Wishing you the best of luck in your 100 days DevOps journey!

1 Like