# Day 5 Task: Advanced Linux Shell Scripting for DevOps Engineers with User management

# Day 5 Task: Advanced Linux Shell Scripting for DevOps Engineers with User management

1. Write a bash script create directories.sh that when the script is executed with three given arguments (one is the directory name and second is start number of directories and third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.

When the script is executed as `./createDirectories.sh day 1 90` then it creates 90 directories as `day1 day2 day3 .... day90`


2. Create a Script to backup all your work done till now.

Backups are very important part for DevOps Engineers now a days. So How to take a backup using shell scripting ?

  • First of all create a directory name of 'Backup' with command mkdir.
  • Now go to other folder/directory where you make the source directory and there you create a file backup.sh where you write a script in bash.
  • And after that run and execute the command. Your Backup will be created.

backup.sh

3. Read About Cron and Crontab, to automate the backup Script.

Cron is the name of the tool, crontab is generally the file that lists the jobs that cron will be executing, and those jobs are, surprise cronjobs. Crontab is mostly used for automation .

To create crontab simply execute "crontab -e" you will be redirected to

13 19 * * * echo "This is my first cron job" > /home/ubuntu/test_cron_first.txt        


5. Create 2 users and just display their Usernames


要查看或添加评论,请登录

Bilal Yousaf的更多文章

社区洞察

其他会员也浏览了