txjcv 发表于 2013-8-5 15:50:31

一段简单的bash script

#!/bin/bash
#This is Mail sent a large number of intelligent bash script
#Write time 2013-8-4
#Author webjin
if [ `id -u` -ne 0 ]
        then
        echo "please use root running"
        su -
fi

if [ `ulimit -n` -le 1024 ]
then
   echo -e "speng soft nofile 10240\nspeng hard nofile 10240" >> /etc/security/limits.conf
   else
   break
   exit 1
fi
adword()
        {
        read -p "please write words ad" title
    echo "$title" >> title.txt
    read -p "please write words ad" content
    echo "$content" >> content.txt
        }

if [ -f ~/title.txt -a -f ~/content.txt -a -f ~/id.txt ]
   then
   echo"the file true cun zai "
    adword
else
#touch {title,content,id}.txt
adword
fi

Max=10000
for(( MID = 0 ;MID < $Max ; MID ++ ))
        do
       
       echo$((16#`dd if=/dev/urandom bs=1 count=4 2>/dev/null| od -A n -t x4|sed s/[^1-9a-fA-F]//g`)) >> ~/id.txt
       
        done

for ID in `cat ~/id.txt`
    do
       
      mail -s " ` < title.txt ` " $ID@qq.com < ~/content.txt
          wait
done
[ -n " 'pgrep mail ' " ] && sleep 15m && > ~/id.txt;> /var/spool/mail/$SUER;
exit 0
==========================以上的参数需要很大cpu和内存、带宽才能操作,要不然你懂得
#!/bin/bash
#This is Mail sent a large number of intelligent bash script
#Write time 2013-8-4
#Author webjin
Max=500
for(( MID = 0 ;MID < $Max ; MID ++ ))
        do
       
       echo$((16#`dd if=/dev/urandom bs=1 count=4 2>/dev/null| od -A n -t x4|sed s/[^1-9a-fA-F]//g`)) >> ~/id.txt
       
        done

for ID in `cat ~/id.txt`
    do
       
      mail -s " ` < title.txt ` " $ID@qq.com < ~/content.txt
          wait
done
[ -n " 'pgrep mail ' " ] && sleep 3m && > ~/id.txt;> /var/spool/mail/$SUER;
exit 0
=================以上脚本小内存的也可以操作,并且方便加入定时任务
#crontab -e
*/5 * * ** /root/script_file_name&

============================欢迎大家加入这个脚本编写当中大家进一步完善它

txjcv 发表于 2013-8-5 15:54:02

对了前提要装sendmail服务

eslizn 发表于 2013-8-5 21:35:52

我最近也在重写以前的一个用邮箱备份数据的shell,不过没有打算使用sendmail,而是直接使用/dev/tcp
页: [1]
查看完整版本: 一段简单的bash script