实现批量linux格式化硬盘和挂载硬盘脚本分享



#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
i=1
while [ $i -lt 13 ] #硬盘数量,除系统盘之外是12块
do
j=`echo $i|awk '{printf "%c",97+$i}'` #系统盘是sda,如果是其它的需要修改脚本
parted /dev/sd$j <<FORMAT
mklabel gpt
mkpart primary 0 -1
ignore
quit
FORMAT
mkfs.ext4 -T largefile /dev/sd${j}1 #格式化磁盘
mkdir /disk${i}
mount="/dev/sd${j}1 /disk${i} ext4 defaults 0 0"
rm -rf /disk${i}/*
echo $mount >>/etc/fstab #写入分区表
i=$(($i+1))
done
echo "/n/n*****Formating and Mounting have finished****/n/n"
mount -a #挂载

从apnic提取ip信息脚本分享
#!/bin/bash#downloadfromapnicrm-fdelegated-apnic-latestwgethttp://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest#IPsallocatedtochina.grep'apnic|CN|ipv4|'delegated-apnic-latest|cut-f4-d'|'deleg

mysql源码安装脚本分享
#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexportPATHclear;SysName=""SysBit=""CpuNum=""RamTotal=""RamSwap=""FileMax=""MysqlVersion="Percona-Server-5.6.15-rel63.0

使用curl递归下载软件脚本分享
#!/bin/envbashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinexportPATHclearUrl="http://mirrors.cnnic.cn/apache/"DownListFile="/tmp/downlist.txt"DownListTmpFile="/tmp/tmplist.txt"Dow