DevOps(Day-7) Advance Linux Scripting

 

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

    Scenario 1: When the script is executed as

    ./createDirectories.sh day 1 90

    then it creates 90 directories as day1 day2 day3 .... day90

    Scenario 2: When the script is executed as

    ./createDirectories.sh Movie 20 50 then it creates 50 directories as Movie20 Movie21 Movie23 ...Movie50

Linux Command Line: Cron Jobs - Snipcademy

Crontab – Quick Reference

  1. Crontab is used to automate the scripts that will run in a set time interval. The format of setting the rules is as shown in the above picture.

    Crontab files are typically stored in the /etc/cron.d/ directory on Linux systems. The crontab command can be used to edit the crontab file.

    crontab -e

    By default, it will edit the crontab entries of the currently logged-in user. To edit other user crontab use the command below:

    crontab -u username -e

    To view the crontab entries of current users use the following command.

    crontab -l

    Use -u followed by the username to view the crontab entries of the specified user.

    crontab -u username -l

    The script will run 1st of every month.

    1. root - It is the superuser that can perform all the actions in a server. This privilege is given at the time of server spin-up.

      With useradd commands, you can add a user.

      Syntax:

      useradd -c "comment" username

      To delete a user account userdel command is used.

      Syntax:

      userdel -r <userName>

      The command usermod is used to modify the properties of an existing user.

      Syntax:

      usermod -c <'newName'> <oldName>

      /etc/passwd - This file contains the detailed information of all the users created in a server.

Comments

Popular posts from this blog

DevOps(Day-97): Meta-Arguments in Terraform

DevOps(Day-95): Auto Scaling with Terraform

DevOps (Day-1) Introduction