90DaysOfDevops

#!/bin/bash


read -p "Enter the starting name of the directories: "name

read -p "Enter the star number of the directories: "st

read -p "Enter the end number of the directory: " end


while [$st -le $end ]

do


mkdir $name$st

   st=$(($st+1))

done

echo "done"


 

Q Create a Script to back up all your work done till now?


#!/bin/bash

#set variables

src_dir='/home/ubuntu/oracle_logs/devops.txt'

backup_dir='/home/ubuntu/dev_backup'

backup_name='backup_$(date +%y-%m-%d %H-%m-%S).tar.gz'

# create a backup dir if not exists

if [ ! -d "$backup_dir" ]; then

mkdir -p "$backup_dir"

fi

# create zipo backup file of source dir

tar -czvf "$backup_dir/$backup_name" "$src_dir"

# check if backup was successful

if [ $? -eq 0 ]; then

else

fi

N

echo "Backup successful"

echo "Backup failed"

|  


Q3)What is Cron and CronTab?

Ans Cron is a time-based job scheduler in Linux and other Unix-like operating systems. It allows users to schedule commands or scripts to run automatically at specific intervals or times. 

Cron is typically used for system maintenance tasks, backups, and other periodic processes.Cron is a time-based job scheduler in Linux and other Unix-like operating systems. It allows users to schedule commands or scripts to run automatically at specific intervals or times. Cron is typically used for system maintenance tasks, backups, and other periodic processes.


CronTab is the configuration file used by Cron to define the schedule for the jobs that it manages. It is a simple text file that lists the commands to be executed and the times at which they should be executed. Each line in the CronTab file represents a job and consists of six fields that specify the minute, hour, day of the month, month, day of the week, and the command to be executed.


CronTab allows users to schedule jobs to run at specific times or intervals, 

such as every minute, hourly, daily, weekly, or monthly. Users can also specify which user account should execute the job and redirect the output of the job to a file.


The Cron daemon reads the CronTab file and executes the scheduled jobs at the appropriate times. Cron is an essential tool for automating routine tasks in Linux and is widely used by

 system administrators and developers to manage and maintain their systems efficiently.


Q.4) What is User management? 

Ans ser management is the process of controlling and managing the user accounts and their access rights to various resources in a computer system. This involves creating, modifying, and deleting user accounts, as well as assigning or revoking privileges or permissions for users.


In a computer system, each user is identified by a unique username and password. User management involves creating and maintaining these accounts and ensuring that users have appropriate access to the resources they need to perform their tasks. This may include files, applications, databases, networks, and other system resources.


User management also involves enforcing security policies, such as password complexity requirements, access control lists, and user role assignments. User management is important for maintaining the security and integrity of a computer system, preventing unauthorized access, and ensuring that users are only able to access the resources they are authorized to use.


Here are some common user management commands in Linux:


adduser: This command is used to add a new user account to the system.


useradd: This command is used to create a new user account in the system.


passwd: This command is used to change the password for a user account.


usermod: This command is used to modify the attributes of an existing user account, such as changing the user's home directory or shell.


userdel: This command is used to delete a user account from the system.


groupadd: This command is used to create a new group in the system.


groupmod: This command is used to modify the attributes of an existing group, such as changing the group's name or adding/removing members.


groupdel: This command is used to delete a group from the system.


chown: This command is used to change the owner of a file or directory.


chgrp: This command is used to change the group ownership of a file or directory.


sudo cat /etc/passwd: This command is used to check user account properties


sudo cat /etc/group: This command is used to check group account properties

Harshitha Harsh

?I help Businesses Upskill their Employees in DevOps | DevOps Mentor & Process Architect

1 年

Thank you for sharing your insights and knowledge on DevOps, Vishal! Your post is definitely helpful for those who are interested in understanding the basics and core concepts of DevOps. Keep up the good work!

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

VISHAL BHARDWAJ的更多文章

社区洞察

其他会员也浏览了