Day 6 of learning Linux

One, for conditional loop statement

                  for variable name in value list for user name in list file

                  do                                                                              do

                              Command sequence Create user and set password

                  done                                                                          done

Two, while conditional loop statement

                  while conditional test operation while not guessing the correct price

                  do                                                                              do

                              Command sequence Repeatedly guess the price of goods

                  done                                                                          done

Three, case conditional test statement

                case variable value in

                Mode 1)

                             Command sequence 1

                             ;;

                Mode 2)

                            Command sequence 2

                             ;;

                           .......

                   *)

                           Default command sequence

                   esac

Four, planning task service procedures

           1. One-time scheduled task: at 19:10 at>reboot at>ctrl+D key combination at -l (to view the one-time scheduled task that has been set but not executed); at -c (to view the detailed content of the scheduled task) ; At -q (name the scheduled task); atrm the number of the scheduled task (delete the scheduled task).

           2. Long-term scheduled tasks: crontab -e (create and edit scheduled tasks); crontab -l (view current scheduled tasks); crontab -r (delete a scheduled task); crontab -u (edit other's scheduled tasks)

                                         Use crond to set the parameter format of the task: minute, hour, day, month and week. Command (the minute field must have a value, and it must not be empty or *)

                                          crontab -e Create a new scheduled task and enter the following information, save and exit

                                         25 3 * * 1,3,5 /user/bin/tar -czvf backup.tar.gz /home/wwwroot Every Monday, Wednesday, and Friday at 3:25 in the morning, use the tar command to check the data directory of a website Pack and process it as a backup file

                                        systemctl status crond View the status of the crond service to see if it is started

                                        systemctl restart crond         

                                        systemctl enable crond

                                         */10 * * * * /user/bin/reboot restart every 10 minutes

                                         10 2,5,10 * * * /user/bin/reboot every day at 2:5:10 and 10 minutes

Five, user identity and capabilities

              Administrator UID (User IDentification) is 0: system administrator user

              Redhat 5/6 system user UID 1-499 ordinary user UID 500-65535

              Redhat 7/8 system user UID 1-999 ordinary user UID 1000~~~~

             When each user is created, a basic user group with the same name will be automatically created. This basic user group has only this user. If the user is included in another user group in the future, this other user group is called an extended user group. A user has only one basic user group, but there can be multiple extended user groups.

              1. useradd: used to create a new user, the format is "useradd [option] username"

                                 Parameters: -d (specify the user's home directory); -e (account expiration time, format is YYYY-MM-DD); -u (specify the user's default UID); -G (specify one or more extended users Group); -g (specify an initial user basic group); -N (not create a basic user group with the same name of the user); -s (specify the user's default Shell interpreter)

             2. groupadd: used to create a user group, the format is "groupadd [option] group name"

                                   groupadd -g 88888 haha

                                   useradd -g 88888 xiaotan

                                   id xiaotan

                                   vim /etc/group can enter it to modify, delete the added extended group, save and exit

               3.usermod: Used to modify the attributes of the user, the format is "usermod [option] username"

                                 usermod -u 8889 abc Modify the UID number value of abc users

               4. passwd: used to modify user password, expiration time, authentication information, etc., the format is "passwd [option] [user name]"

               5.userdel: Used to delete users, the format is "userdel [option] username"

                                Parameters: -f (force delete user); -r (delete user and user home directory at the same time)





       

Guess you like

Origin blog.51cto.com/15047572/2592727