Table of contents
- โข Write a bash script createDirectoriess1.sh that when the script is executed with three given arguments (one is the directory name and second is the start number of directories and the third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.
- โข Create a script to backup all your work done till now .
- โข Read about cron and crontab, to automate the script.
- โข User management
Day 5 TASK
Click to check Day 5 task
โข Write a bash script createDirectoriess1.sh that when the script is executed with three given arguments (one is the directory name and second is the start number of directories and the third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.
You have to do the same using Shell Script i.e using either Loops or command with start day and end day variables using arguments Example 1: When the script is executed as
./createDirectories.sh day 1 90
then it creates 90 directories as day1 day2 day3 .... day90
Using Command
Using Loop
โข Create a script to backup all your work done till now .
Create directory name 'jay' and content is 'dir.sh' ( day01 .. day90)
Create empty directory name 'chavda' for backup. Backup script is written in 'file.sh'
Backup script looks like below ๐
And the result is ๐
โข Read about cron and crontab, to automate the script.
A crontab file is composed of six fields, separated by spaces, that specify the schedule for a task to run. The fields, in order, are:
Minute (0โ59)
Hour (0โ23)
Day of the month (1โ31)
Month (1โ12)
Day of the week (0โ7, where both 0 and 7 represent Sunday)
Command to be executed
Cron jobs are jobs that are scheduled to run at specific intervals. you might have a command to perform something every hour, year, or every day. they are very powerful, especially on servers to perform maintenance and automation.
The crontab
command is the entry point to work with corn jobs.
The first thing you can do is to explore which cron jobs are defined by you: crontab -l
crontab -e
to edit the cron jobs, and add new ones.
You can also use crontab -r
to remove your current crontab file.
crontab -d
to delete a specific user crontab and
cron -l -u <username>
to list a specific user crontab.
โข User management
User management refers to the process of creating, modifying, and deleting user accounts on a computer system or network. It also includes managing user permissions and access to resources.
System users are created to run specific system processes or services. They are not meant for interactive logins.
Local users are created for human users who interact with the system. They may have home directories amd can log in to the system.
To create new user useradd
To Changes into user usermod
To delete user userdel
To change password passwd
Create 2 users
_Wow! You are at the end, if it is helpful please do follow โ and like to support.๐
_Thank you for reading. ๐
_Jay