Linux OPS Practice-January 19, 2016-February 3 course Assignments

Source: Internet
Author: User
Tags log log

I. Homework (exercise) content:

1, describe the CENTOS6 system boot process;

A. Boot BIOS power-on self-detect various hardware information

B. Read the first bootable device MBR, load grub

C. Initialize the kernel information according to the settings of boot loader, the kernel implements the mount of the root file system according to the INITRD virtual disk and file system

d. switch to the root file system,

E. Start the system the first process init, ready the services required for the system

F. Login interface



2, Description/etc/rc.d/sysinit script function;

By analyzing the code, you can see the features of Sysinit:

A. Access to the network environment and host name

B. Activating Udev and SELinux

C. mount the file system defined in the/etc/fstab file

D. To detect the root file system and reload the mount root filesystem in read/write mode

E. Set the system clock;

F. Activating swap devices

G. Setting kernel parameters According to the/etc/sysctl.conf file

H. Activating LVM and soft raid devices

I. Loading drivers for additional devices

J. Clean-up operations


3. Summarize the usage of the Text Processing tool sed and awk (must accompany the example)

Sed

: Expression-Addressable

N: No output by default

P: Print

Example:

#打印包含TEM的行

Sed-ne '/tem/p ' gc.txt

H: Append to hold Space

D: Multi-row deletion

$: Last line

!: Take counter

G: Space coverage mode from the hold space

s:/is replaced/replaced/

Example:

#删除所有换行符

Sed ' h;$! D;g;s/\n//g '


Awk

awk '/Regular expression/{process} ' input file

$ full Line The first field $NF the last 1 fields

Here is a section of the MySQL database code on line

Slave_stat= ($ ($slave _tool-e "show slave status\g" |grep Running |awk ' {print $} '))



4, write a script, generate 10 random numbers, and according to the order from small to large (requires at least 2 Chinese law);

For i in ' seq 1 ';d o echo $RANDOM;d one | sort-n


5. Execute the script/data/get_username.sh at 1:5 A.M. every Tuesday and output the script to the/tmp/get_username.log log file;


/usr/bin/mysqldump-uclient-p**************** jzjz >/data/mysqlbak/' Date +%y%m%d '. sql

If [$?-eq 0];then

echo "Backup OK" >>/tmp/log/mysqlbak.log

Else

echo "Backup Error" >>/tmp/log/mysqlbak.log

Fi


Cortab-e

0 2 * * */data/mysqlbak/backup_mysql.sh


6. Write a script: If a path does not exist, it is created as a directory, otherwise it is present, and the content type is displayed;


#!/bin/bash

#

If [-Z $];then

echo "Usage:$0 <path>"

Exit 1

Fi

if [!-D $];then

Mkdir-p $

Else

echo "is exists."

File $

Fi



7, write a script, print 9x9 multiplication table;

#!/bin/bash

For I in 1 2 3 4 5 6 7 8 9;d o

For j in 1 2 3 4 5 6 7 8 9;d o

printf "%2d" $ ((i*j))

Done

Echo

Done


8, describe the work flow of DNS, as well as a complete set of DNS master-slave server, the relevant domain name and IP can be set by itself.


Linux OPS Practice-January 19, 2016-February 3 course Assignments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.