Shell advanced Programming Enterprise Practical problem programming---is the mule is the horse pulls out to slip!

Source: Internet
Author: User



Enterprise qualified Linux operations must be programming problems, can be completed independently of the students employment wages will not be less than 10K



This is the old boy Linux Viban requirements students will be the topic, can not be qualified to graduate, each completed the reward value of 500-1000 yuan equivalent gift (to the same day Test results announced as the quasi), to go back to their choice, partners to walk!



Actual combat test time on April 15, 2015 on-machine combat, prohibit large-scale plagiarism learning class notes otherwise no reward!
A total of 18 test questions, face-to-face lectures almost all of the similar cases, the exam questions slightly changed.





Enterprise face question 1: (production case): monitor MySQL master-slave synchronization is abnormal, if abnormal, send sms or mail to the administrator. Note: If there is no master-slave synchronization environment, you can use the following text to read in the file to simulate:
Phase 2: If the following error number (1158,1159,1008,1007,1062) is present in the synchronization, the error is skipped.
Phase 3: Use array technology to implement the above script (get master-slave judgment and Error number section)


[[email protected] ~] # 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 important
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:


Enterprise Face question 2:
Use the For loop in the/oldboy directory to create 10 HTML files in bulk by using a random lowercase 10-letter plus a fixed string oldboy, for example:


[[email protected] oldboy]# sh /server/scripts/oldboy.sh
[[email protected] 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





Enterprise Face question 2: Please use at least two ways to achieve!
Change all the Oldboy in the above file name to Oldgirl (implemented with a For loop) and the HTML to uppercase.







Enterprise Face question 3:
Batch Create 10 System account OLDBOY01-OLDBOY10 and set the password (password is a random 8-bit string).





Enterprise Face question 4:
Write a script that enables you to determine the IP of the current online user in the 10.0.0.0/24 network (there are many ways)





Enterprise Combat Problem 5: Please use at least two ways to achieve!
Write a script to solve the DOS attack production case
Tip: Depending on the number of web logs or network connections, monitoring when an IP concurrent connection number or a short time PV reached 100, that is, call the firewall command to block the corresponding IP, monitoring frequency every 3 minutes. The firewall command is: iptables-a input-s 10.0.1.10-j DROP.





Enterprise Combat Problem 6:
To develop a MySQL multi-instance startup script:
Known MySQL multi-instance start commands are: Mysqld_safe--defaults-file=/data/3306/my.cnf &
The Stop command is: mysqladmin-u root-poldboy123-s/data/3306/mysql.sockshutdown
Please complete the compilation of MySQL multi-instance startup script
Requirements: Implemented with functions, case statements, if statements, and so on.



Enterprise Actual Combat Problem 7: How to implement the MySQL database for sub-library backup, please use the script to implement





Enterprise Actual combat Problem 8: How to implement the MySQL database sub-Library plus table backup, please use the script to implement





Enterprise Face question 9: Please use at least two ways to achieve!
The bash for loop prints the words in the following sentence that are not more than 6 in number (the Kunlun worldwide interview question).
I am Oldboy Teacher Welcome to Oldboy training class.





Enterprise Face question: the shell scripts were developed to compare 2 integer sizes in the same way as script arguments and read reads. Alerts users to compare results in a screen-out manner. Note: Altogether is the development of 2 scripts. When a script is used to pass a parameter and read in the way it needs to determine whether the variable is a number, and how many parameters to pass.



Enterprise Face questions one by one: Print Selection menu, one-click Installation Web Service:



[Email protected]]# sh menu.sh



1.[install Lamp]



2.[install LNMP]



3.[exit]



pls input the num you want:



Requirements:



1 when the user enters Span style= "font-family: ' Times New Roman ', serif;" >1 "then execute /server/scripts/lamp.sh "Lampis Installed" exit script;



2 , when the user enters 2 when the output " startinstalling Lnmp. "then perform /server/scripts/lnmp.sh Output "Lnmpis Installed" exit script after ;



3 , when the input 3 , exit the current menu and script;



4 , when entering any other characters, give the hint " Input Error "After exiting the script.



5, to the execution of the script to determine the relevant conditions, such as: whether the script exists, whether it can be executed, etc.




Enterprise Face question 12:



1 , monitoring Web service is normal, no less than 3 kinds of monitoring policies.



2, monitoring the DB service is normal, not less than 3 kinds of monitoring strategy.
1-minute interval, continuous monitoring is required.





Enterprise Face Test : Monitoring memcache If the service is normal, impersonate the user ( Web client) detection.



Use NC commands plus set/get to simulate detection, and monitor response times and hit ratios.




Enterprise Face Test : Interview and actual combat exam questions: Monitoring the Web site Directory (/var/html/www) All files have been tampered with (the contents of the file has been changed), if there is a change in the name of the file (e-mail), the scheduled task every 3 minutes (10 minutes to complete).



Enterprise Face question: Enterprise Case : Write Network Service standalone process mode rsync the system startup script



For example:/etc/init.d/rsyncd{start|stop|restart}.
Requirements:
1. To use the System function library technique.
2. To use a function, not a lump of Shi's way.
3. Can be managed by chkconfig.





Enterprise Face question 16: old boy Education Tianjin Project Student Practice Lottery topic:



Good news, the old boy training students to go out of Business Project Practice Opportunities (6th time) came (mid-month), however, the quota is limited, the number of members limited to 3 (squad Leader).



Therefore, students need to be selected, so a lottery program is required:



Requirements:



1, the implementation of the script, want to go to the students to enter the full spelling of the English name, produce a random number of 01-99 between the number, the larger the number will go to participate in project practice, the previous number has been caught, the next time can not appear the same number.



2, the first input name, the screen output information, and the name and number recorded in the file, the program can not exit continue to wait for other students input .





Enterprise Face question: old boy Linux Enterprise Interview questions:



The following string is known to be passed RANDOM Random number variable md5sum|cut-c 1-8 after intercepting the result, please crack these strings corresponding to the md5sum before the RANDOM corresponding numbers?



21029299



00205d1c



a3da1677



1f6d12dd



890684b







Enterprise Face test: Batch Check multiple Web site addresses are normal



Requirements: Shell array method Implementation, detection strategy as far as possible to simulate user access ideas



http://www.etiantian.org



Http://www.taobao.com



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



http://10.0.0.7






Reprint of the Netizen, please be sure to keep all the content thank you.






Inspection criteria:



1, review the implementation of the script, and ask the script design ideas and implementation process.



2. If necessary, the interviewer can look at you and ask you to re-develop it.



3, inspectors: Monitor, team leader, old boy teacher, teaching assistant.



This article is from the "Old boy Linux ops" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1632876



Shell advanced Programming Enterprise Practical problem programming---is the mule is the horse pulls out to slip!


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.