前言
創新互聯公司成立于2013年,是專業互聯網技術服務公司,擁有項目成都做網站、成都網站建設網站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元自流井做網站,已為上家服務,為自流井各地企業和個人服務,聯系電話:028-86922220
[root@localhost ~]# arping -c 2 -w 1 -I ens33 192.168.247.134
ARPING 192.168.247.134 from 192.168.247.136 ens33
Unicast reply from 192.168.247.134 [00:0C:29:52:4D:89] 1.452ms
Unicast reply from 192.168.247.134 [00:0C:29:52:4D:89] 1.182ms
Sent 2 probes (1 broadcast(s))
Received 2 response(s)
配置ftp匿名訪問模式, 首先輸入命令“vi /etc/vsftpd/vsftpd.conf” 打開ftp服務具體配置文件
進行修改(有點改,沒有的添)(去“#”號)
參數 | 作用 |
---|---|
anonymous_enable=YES | 允許匿名訪問模式。 |
anon_umask=022 | 匿名用戶上傳文件的umask值。 |
anon_upload_enable=YES | 允許匿名用戶上傳文件 |
anon_mkdir_write_enable=YES | 允許匿名用戶創建目錄 |
anon_other_write_enable=YES | 允許匿名用戶修改目錄名或刪除目錄 |
#!/bin/bash
#測試文件是否存在,若存在,就將當前文件備份
[ -f /etc/ethers ]
if [ $? -eq 0 ]
then
cp -p /etc/ethers /etc/ethers.bak
fi
#去ping254個地址,將成功的ip地址和mac追加到/ethers
for ((i=134;i<=139;i++))
do
ping -c 3 -w 3 192.168.247.$i &> /dev/null
if [ $? -eq 0 ]
then
echo "192.168.247.$i 存活"
fi
done
arp -n | grep "ether" | awk '{print $1,$3}' > /etc/ethers
#檢查是否安裝nmap掃描軟件
rpm -q nmap
if [ $? -eq 1 ]
then
yum clean all
yum list
yum install nmap -y
[ $? -eq 0 ] && echo "未安裝namp掃描工具,當前已為您安裝"
fi
#檢查有哪些ip開啟了匿名服務ftp服務,即22端口
for a in $(cat /etc/ethers | awk '{print $1}')
do
m=$(nmap -sT $a -p 21 | awk '/ftp/{print $2}')
if [ $m = open ]
then
echo "$a 開啟ftp服務"
fi
done
#!/bin/bash
#/根分區的當前占用率
DUG=$(df -Th | grep '/$' | awk '{print $6}' | sed 's/%//')
#cpu 的當前空閑占用率
CUG=$(mpstat | grep 'all' | awk '{print $13}' | awk -F. '{print $1}')
#內存當前占用率
used=$(free | grep 'Mem' | awk '{print $3}')
total=$(free | grep 'Mem' | awk '{print $2}')
(( MUG = used*100/total))
genfenquzhanyong=當前根磁盤占用未到警戒線20%
cpukongxian=當前cpu空閑資源未低于警戒線1%
neicunzhanyong=當前內存占用未超過警戒線10%
#當根分區占用率超過10時
if [ $DUG -gt 10 ]
then
echo `date` >> /tmp/alert.txt
echo "當前磁盤占用超過10%" >> /tmp/alert.txt
genfenquzhanyong='當前根磁盤占用超過警戒線20%,為$DUG%'
fi
#當cpu的空閑內存小于20時
if [ $CUG -lt 1 ]
then
echo `date` >> /tmp/alert.txt
echo "當前cpu空閑資源小于1%" >> /tmp/alert.txt
cpukongxian='當前cpu空閑資源低于警戒線1%,為$CUG'
fi
if [ $MUG -gt 10 ]
then
echo `date` >> /tmp/alert.txt
echo "當前內存占用超過10%" >> /tmp/alert.txt
neicunzhanyong='當前內存占用超過警戒線10%,為$MUG'
fi
rpm -q expect
if [ $? -ne 0 ]
then
yum install expect -y
fi
echo "$genfenquzhanyong,$cpukongxian,$neicunzhanyong" | mail "965483130@qq.com"
[root@localhost ~]# crontab -e -u root
[root@localhost ~]# crontab -l
30 * * * * /usr/bin/sh /root/sysmon.sh
分享名稱:實操:shell編程實戰
分享URL:http://m.newbst.com/article22/jespcc.html
成都網站建設公司_創新互聯,為您提供營銷型網站建設、商城網站、微信小程序、網站設計、搜索引擎優化、域名注冊
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯