(turn) qualified Linux OPS personnel must be 30-way shell programming surface questions and explanations

Source: Internet
Author: User
Tags svn
Super in-depth explanation of shell advanced programming combat. As of now, the shell programming course is the most detailed course in domestic training institutions. I do n’t believe it, please see the level of performance of the students.

The course is not cow, not to look at the teacher, the timetable, but to look at the level of the students being trained. At present, all the partners are free to watch.

http://edu.51cto.com/course/course_id-5257.html

 

Enterprise qualified Linux operation and maintenance must be programming questions, and the employment salary of students who can complete independently will not be lower than 12K

This is a topic that the old boy linux operation and maintenance class requires students to meet. If you ca n’t complete the graduation, you will be rewarded with an equivalent gift worth 500-1000 yuan (subject to the announcement of the test score on the day) Retreat to one's own choice, and the partners go!

The actual combat test time is on January 15, 2016. The actual combat is on the machine. Large-scale plagiarism of learning classroom notes is prohibited or there will be no reward!
A total of 21 exam questions, almost all of the face-to-face lectures have explained similar cases, the exam questions have changed slightly.

 

Enterprise interview question 1: (Production combat case): Monitor whether the MySQL master-slave synchronization is abnormal, if it is abnormal, send a text message or email to the administrator. Tip: If there is no master-slave synchronization environment, you can use the following text to read in the file to simulate:
Phase 1: Develop a daemon script to detect every 30 seconds.
Phase 2: If the following error number (1158, 1159, 1008, 1007, 1062) appears during synchronization, the error is skipped.
Stage 3: Please use array technology to implement the above script (get the master-slave judgment and error number part)

[root @ oldboy ~] # mysql -uroot -p‘oldboy ‘-S /data/3307/mysql.sock -e" show slavestatus \ G; "
*************************** 1. row ******************** *******
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.0.0.179 #Current mysql master server host
                  Master_User: rep
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000013
         Read_Master_Log_Pos: 502547
               Relay_Log_File: relay-bin.000013
                Relay_Log_Pos: 251
        Relay_Master_Log_File: mysql-bin.000013
             Slave_IO_Running: Yes
           Slave_SQL_Running: Yes
              Replicate_Do_DB:
         Replicate_Ignore_DB: mysql
          Replicate_Do_Table:
      Replicate_Ignore_Table:
     Replicate_Wild_Do_Table:
 Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
         Exec_Master_Log_Pos: 502547
              Relay_Log_Space: 502986
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
          Master_SSL_Allowed: No
          Master_SSL_CA_File:
          Master_SSL_CA_Path:
              Master_SSL_Cert:
           Master_SSL_Cipher:
               Master_SSL_Key:
       Seconds_Behind_Master: 0 #The number of seconds that the synchronization with the master library is delayed, this parameter is very important
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
Business Interview Question 2:
Use the for loop to create 10 html files in batches in the / oldboy directory by randomly lowercase 10 letters plus a fixed string oldboy. The name is for example:


[root @ oldboy oldboy] # sh /server/scripts/oldboy.sh
[root @ oldboy oldboy] # ls
coaolvajcq_oldboy.html qnvuxvicni_oldboy.html vioesjmcbu_oldboy.html
gmkhrancxh_oldboy.html tmdjormaxr_oldboy.html wzewnojiwe_oldboy.html
jdxexendbe_oldboy.html ugaywanjlm_oldboy.html xzzruhdzda_oldboy.html
qcawgsrtkp_oldboy.html vfrphtqjpc_oldboy.html
 

Business interview question 3: Please use at least two methods to achieve!
Change all oldboy in the above file name to oldgirl (implemented with for loop), and change html to uppercase.

 

 

Business Interview Question 4:
Create 10 system accounts oldboy01-oldboy10 in batches and set a password (password is a random 8-digit string).



Business Interview Question 5:
Write a script to determine what the current online user's IP is on the 10.0.0.0/24 network (there are many methods)



Enterprise combat question 6: Please use at least two methods to achieve!
Write a script to solve the DOS attack production case
Tip: According to the web log or the number of network connections, monitor the number of concurrent connections of an IP or the PV reaches 100 within a short time, that is, call the firewall command to seal off the corresponding IP, and the monitoring frequency is every 3 minutes. The firewall command is: iptables -I INPUT -s 10.0.1.10 -j DROP.



Business practical problem 7:
Develop mysql multi-instance startup script:
Known mysql multi-instance start command is: mysqld_safe--defaults-file = / data / 3306 / my.cnf &
The stop command is: mysqladmin -u root -poldboy123 -S /data/3306/mysql.sockshutdown
Please complete the preparation of mysql multi-instance startup script
Requirements: Use functions, case statements, if statements, etc.


Enterprise practical problem 8: how to implement MySQL database backup, please use script to achieve



Enterprise practical problem 9: how to realize the MySQL database and sub-table backup, please use the script to achieve



Business interview question 10: Please use at least two methods to achieve!
bash for loop prints the words with no more than 6 letters in the following sentence (Kunlun Wanwei interview questions).
I am oldboy teacher welcome to oldboy training class.



Enterprise Interview Question 11: Develop shell scripts to compare the size of two integers by means of script parameter passing and read reading. The user is reminded of the comparison results by means of screen output. Note: A total of 2 scripts are developed. When using scripts to pass parameters and read read methods, it is necessary to judge whether the variable is a number and the number of passed parameters.


Corporate Interview Question 12: Print the selection menu and install Web services with one click:

[root @ oldboyscripts] # sh menu.sh

    1. [install lamp]

    2. [install lnmp]

    3. [exit]

    pls input the num you want:

Claim:

1. When the user enters 1, output "startinstalling lamp." And then execute /server/scripts/lamp.sh, the script content outputs "lampis installed" and exits the script;

2. When the user enters 2, output "startinstalling lnmp." And then execute /server/scripts/lnmp.sh to output "lnmpis installed" and exit the script;

3. When entering 3, exit the current menu and script;

4. When entering any other character, exit the script after giving the prompt "Input error".

5. Judging the relevant conditions of the executed script, for example, whether the script exists and is executable.



Business Interview Question 13:

1. Monitor whether the web service is normal, no less than 3 monitoring strategies.

2. Monitor whether the db service is normal, no less than 3 monitoring strategies.
Requires 1 minute interval for continuous monitoring.

 

Enterprise interview question 14: monitor whether the memcache service is normal, and simulate user (web client) detection.

Use the nc command plus set / get to simulate detection, and monitor response time and hit rate.



Corporate interview question 15: Interview and practical exam questions: monitor whether all files in the web site directory (/ var / html / www) have been maliciously tampered (the content of the file has been changed), and if so, print the changed file name (email) , The scheduled task is executed every 3 minutes (10 minutes to complete).
 

Business Interview Question 16: Business Case: Writing a system startup script for rsync in the independent process mode of network services

For example: /etc/init.d/rsyncd{start|stop|restart}.
Claim:
1. To use system function library skills.
2. If you want to use functions, you cannot use SHI.
3. Can be managed by chkconfig.

 

Corporate Interview Question 17: Old Boy Education Tianjin Project Students Practicing Problems Topics:

The good news is that the opportunity for the old boy to train students to go out to the enterprise project (the 6th) came (mid-month), but the quota is limited, and the team is limited to 3 people (the leader of the team).

Therefore, it is necessary to select students, so a program of arrest is needed:

Claim:

1. After the script is executed, the students who want to go enter the English name and spell it out, and a random number between 01 and 99 is generated. The larger the number, go to participate in the project practice. The number that has been caught before can not appear the same number next time .

2. After the first input of the name, the screen outputs information and records the name and number in the file. The program cannot exit and continue to wait for other students to enter.
 

 

Business interview questions 18: Old boy linux business interview questions:

It is known that the following strings are the result of interception by the RANDOM random number variable md5sum | cut-c 1-8. Please crack the corresponding RANDOM number before md5sum corresponding to these strings?

21029299

00205d1c

a3da1677

1f6d12dd

890684b

 

 

Business Interview Question 19: Checking whether multiple website addresses are normal in batches

Requirement: The shell array method is implemented, and the detection strategy is to simulate the user access idea as much as possible

http://www.etiantian.org

http://www.taobao.com

http://oldboy.blog.51cto.com

http://10.0.0.7

 

 

Business Interview Question 20 (China Enterprise Power): Use the shell to handle the following

1. Sort in descending order by the frequency of words!

2. Sort in descending order by frequency of letters!

the squid project provides a number of resources t
oassist users design, implement and support squid installations. Please browse the documentation and support sections for more infomation

Corporate interview question 21: output square, isosceles triangle, right angle trapezoid, see below

http://oldboy.blog.51cto.com/2561410/1718607

 

Enterprise Interview Question 22: Develop to display and monitor the status of Nginx proxy nodes through the web interface.

technology sharing

Part of Shell enterprise case of lvs + keepalived cluster:

Enterprise interview question 23, [LVS master node] manually develop ipvsadm management lvs script ip_vs

   Implementation: /etc/init.d/lvs {start | stop | restart}

 

Business interview questions 24, [LVS master node] Simulate keepalived health check function management LVS node,

When the node hangs (detect 2 times, interval 2 seconds) is removed from the server pool, OK (detect 2 times, interval 2 seconds) is added

Tip: Use the ipvsadm command to add and remove LVS nodes.

 

Enterprise Interview Question 25, [LVS Client Node] Develop a management script for LVS client to set VIP and suppress ARP

    Implementation: /etc/init.d/lvsclient {start | stop | restart}

Enterprise Interview Question 26. [LVS Standby Node] Simulate the keepalved vrrp function, monitor the master node, if the master node is not accessible, the standby node starts and configures LVS to take over the resources of the master node to provide services (reminder: pay attention to ARP cache)

 

Business Interview Question 27. Please write a square (oldboy_square.sh) in shell or Python to receive the numbers entered by the user.

E.g:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root @ oldboy ~] # sh oldboy_square1.sh
Please Enter a number: 5
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
[root @ oldboy ~] # sh oldboy_square2.sh
Please Enter a number: 9
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
■■■■■■■■■
Corporate Interview Question 28. Please write an isosceles triangle (oldboy2_triangle.sh) in shell or Python to receive the numbers entered by the user

E.g:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root @ oldboy ~] # sh oldboy2_triangle.sh
Please Enter a number: 5
    *
   ***
  *****
 *******
*********
[root @ oldboy ~] # sh oldboy2_triangle.sh
Please Enter a number: 8
       *
      ***
     *****
    *******
   *********
  ***********
 *************
***************
Enterprise Interview Question 29. Please write a right angle trapezoid program (oldboy4.sh) with shell or Python, and receive the parameters n, m input by the user

E.g:

1
2
3
4
[root @ oldboy ~] # sh oldboy4.sh 4 6
****
*****
******
27, 28, 29 three questions reference http://oldboy.blog.51cto.com/2561410/1718607

 

Enterprise Interview Question 30: Write a set of simple enterprise code online publishing system cases, use SVN to manage the code and configuration files, take the specified version of the code and configuration from the svn on the office server, and publish it to the IDC computer room distribution machine server. On the distribution server or load balancer or the application server locally, the code can be smoothly released, launched, and rolled back the script (for specific design, please refer to the enterprise code release solution explained in the classroom).

 

 

Corporate Interview Question 31: Please design a set of Git + Saltstack implementation code for online publishing and management program.

(Refer to the book of learning Linux operation and maintenance with the old boy: Shell advanced programming combat book content)

Reprinted netizens, please be sure to keep the entire content of this article, thank you.

 

inspection criteria:

1. View the implemented script and ask about the design ideas and implementation process in the script.

2. If necessary, the interviewer can watch you ask you to redevelop it.

3. Examiner: class leader, team leader, old boy teacher, teaching assistant.

This article is from the "Old Boy Linux Training" blog, please keep this source http://oldboy.blog.51cto.com/2561410/1632876

(Transfer) 30 shell programming interview questions and explanations that qualified Linux operation and maintenance personnel will meet

Tag: target rollback score class cut result master enter production case

Original address: http://www.cnblogs.com/liujiacai/p/7819443.html

Dislike
(0)
awesome
(0)
Related Article

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.