Shell programming actual combat 7

1. Count the number of digits in the document

Share a picture

2. Compare the differences between the files of the two machines

< /table>

3. Batch killing processes

Share pictures

4. Statistic network card traffic

Share pictures

5. Determine the type of web service

Share picture

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5519 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.

#!/bin/bash

dir=/data/web

[ -f /tmp/md5.list] && >/tmp/md5.list # /tmp directory is Must exist, md5.list file must be empty or deleted

find $dir/ -type f> /tmp/file.list
while read line
do
md5sum $line> > /tmp/md5.list # Circular append
done

scp /tmp/md5.list B:/tmp/
[ -f /tmp/check_md5 .sh] && rm -f /tmp/check_md5.sh

# Script file to be embedded
cat> /tmp/check_md5.sh << EOF
#!/bin/bash< br>dir=/data/web
n=\`wc -l /tmp/md5.list\` # Since there can be no spaces in the lines of the file in the for loop, all the loop conditions are converted to the number of lines of the file
for i in \`seq 1 \$n\` # Take the value of the variable $n and escape it, otherwise it is the value of $n
do
file_name=\`sed -n “\ $i”p /tmp/md5.list |awk'{print $2}’\`
md5=\`sed -n “\$i”p /tmp/md5.list |awk'{print $1}’ \`
if [-f \$file_name ]
then
md5_b=\`md5sum \$file_name\`
if [\$md5_b != \$md5 ]
then
echo “\$file_name has cha nged”
fi
else
echo “\$file_name is lost”
fi
done
EOF
scp /tmp/check_md5.sh B:/tmp/
ssh B “/bin/bash /tmp/check_md5.sh” #ssh after connecting to machine B, run /bin/bash /tmp/check_md5.sh