shell programming combat 15

1. Find the differences between two files

 

2. Kill a user process

 

3. concurrent backup database

#!/bin/bash

N = 5 ## defined as the amount of concurrency. 5
MySQL = "mydb the mysqldump -uaming -ppasswd"

MySQL -e $ "Show Tables;" | Sed '1D'> /tmp/table.list
n-WC = `-l /tmp/table.list|awk '{}. 1 Print $'` number of tables ##

div ()
{
n-echo = `" = Scale. 1; $. 1/2 $ "| bc` ## divide two numbers
n1 =` echo "scale = 1 ; $ n + 0.5" | bc` ## two numbers business plus 0.5 in addition to the
echo $ N1 |. Cut -f1 -d 
}

n1 = `div $ n $ N` $ N files, the implementation of the true number of average number of lines per file, each file in the non-
split -l $ n1 /tmp/tab.list -d -a 2 tablist

Function ## define the backup of the database table for a division of the $ N tablist0? File in a database table to do a backup,
## per tablist0? File has about $ n1 database table
mydump ()
{
for t in `$ 1 CAT `
do
the mysqldump -uaming -ppasswd mydb T $> $ t.sql
DONE
}

for f in tablist01 tablist02 tablist03 tablist04 tablist05
do
mydump $f & ## 针对$N个数据库表文件,同时并发做数据库表备份
done

wait 
#tar zcvf mydb.tar.gz *.sql &>/dev/null
tar zcf mydb.tar.gz *.sql
rm -f *.sql

 

 

4. 监控CDN节点

   

 

 

5. 破解md5sum加密的数字

  

6. 判断cpu厂商

  

Guess you like

Origin www.cnblogs.com/tanzhirong/p/11530981.html