Qihoo 360 operation and maintenance engineers face questions

, Write a script to find the last time was created three days ago, the suffix is * .log files and delete.
2, write a script file larger than 100k under a directory to move up / down tmp.
3, write a script to back up a database and packaged under 192.168.1.1 / backup directory of the remote server.
4, write a script to configure the firewall to allow only remote host access port 80 of the machine.
5, write a script for nginx log statistics, ip get access to most of the top 10 (nginx log path: /home/logs/nginx/default/access.log).
6. Write the following command meaning
(1) MaxKeepAliveRequests 100
(2) Options FollowSymLinks
the Order Deny the Allow
Deny from All
the Allow from 192.168.1.1
7, write a script to replace the specified file in the / usr / local directory for anything else.
8, please briefly discusses the responsibilities of operation and maintenance engineers.

================================================== ======================
1, write a script to find the last time was created three days ago, is a suffix .log file and delete it.
Find / -name "
.log" +3 -exec -ctime RM -f {};

2, write a script file larger than 100k under a directory to move up / down tmp.
I in for find /test -type f -size +100k; do CD / Music Videos $ && Test I / tmp; DONE

3, write a script to back up a database and packaged under 192.168.1.1 / backup directory of the remote server.
192.168.1.1:/backup Mount / mnt
CD / mnt
/ usr / local / MySQL / bin / the mysqldump -hlocalhost -uroot-Test> test.sql
the tar CZF test.sql.tar.gz test.sql
RM -f test.sql

4, write a script to configure the firewall to allow only remote host access port 80 of the machine.
the INPUT -P ACCEPT iptables
iptables -P the OUTPUT ACCEPT
iptables -P the FORWARD ACCEPT
iptables -F
iptables the -X-
iptables -A the INPUT -i eth0 -p TCP --dport 80 -j ACCEPT
iptables the DROP the INPUT -P

5, to write a script nginx log statistics, to give access to most of the top 10 ip (nginx log path: /home/logs/nginx/default/access.log
awk '{A [$. 1] ++} the END {for (J in a) print a [j] , j} '/home/logs/nginx/default/access.log|sort -nr | head -10

6. Write command following meanings
(1) MaxKeepAliveRequests maximum number of connection request 100
(2) Options FollowSymLinks 192.168.1.1 can allow a directory listing
the Order Deny the Allow
Deny from All
the Allow from 192.168.1.1
directory file 7. Alternatively
sed ' s: / user / local: / tmp: g 'filename

OTHERS

The odds of relatively high:
1, a brief description of the startup process of Linux?
BIOS boot (mbr loader from the boot manager grub) ---- GRUB boot (initrd loader and kernel memory) ----- -sys init initializes the kernel boot parameters ..

2, a brief description of the service the following ports are running
21,22,23,25,110,143,873,3306 ftp ssh telnet snmp pop3 IMAP rsync

3, TCP decapitated minimum length is __64_ bytes?
4, so that a normal user can perform cp / dir1 / file1 / dir2 order, please indicate the minimum dir1 file1 has what authority?
rx
5, briefly TCP three-way handshake process?
Client sends a request SYN, the server receives the request and acknowledgment response SYN + ACK, the client sends back ACK response ....


The first question: How will forward the request to the local port 80 to port 8080, the current host IP is 192.168.2.1?
The second question: the number of visits by Apache access log access.log and statistics for each IP address, before descending by 10?
Third question: shell scripting, obtain the network address of the machine. Such as IP address is 192.168.100.2/255.255.255.0, so that the network address is 192.168.100.1/255.255.255.0
. 1:
iptables -t NAT -A 192.168.10.10 the PREROUTING -d -p TCP -j DNAT --dport 80 - Where do you want 192.168.10.10:8080--to
iptables -t NAT -A 192.168.10.10 -p UDP --dport the PREROUTING -d -j DNAT --to-80 Where do you want 192.168.10.10:8080
2:
CAT access_log | awk '{Print . 1} $ '| Sort | the uniq -C | -NR Sort
. 3:

!/bin/bash

ip=ifconfig|grep -A1 eth0|grep 'inet add'|awk -F: '{print $2}'|awk '{print $1}'
mask=ifconfig|grep -A1 eth0|grep 'inet add'|awk -F: '{print $NF}'
echo "$ip/$mask"

ip=ifconfig eth0|grep -E "inet add"|awk '{print $2}'|awk -F: '{print $2}'

  1. Find a centralized approach where the line number of blank lines

[root@mail ~]# sed -n ''/[a-zA-Z0-9@#$%^&*]/!='' aa.txt

[root@mail ~]# grep -n ^$ aa.txt

[root@mail ~]# awk ''/^$/{print NR}'' aa.txt
[root@mail ~]# sed -n ''/^$/='' aa.txt

Guess you like

Origin www.cnblogs.com/knight-zhou/p/12067377.html