批量化脚本(一)

#/bin/bash
#########################################
#Function:    auto fdisk
#Author:      dengguoxing
#########################################

#fdisk ,formating and create the file system
fdisk_fun()
{
fdisk $1 << EOF
n
p
1


wq
EOF

sleep 10
mkfs.ext4 /dev/hioa1
}

#config /etc/fstab and mount device
main()
{  
  echo -e "\033[40;32mStep 2.Begin to fdisk free disk.\033[40;37m"
  sleep 10
  fdisk_fun /dev/hioa    
  echo '/dev/sda1  /data ext4    defaults    0  0' >> /etc/fstab  
  mount -a
}

#=========start script===========
echo -e "\033[40;32mStep 1.Begin to install script.\033[40;37m"
sleep 10
mkdir /ssd
mkdir /data
main
df -h

 

posted @ 2016-04-27 19:53  welkinok  Views(239)  Comments(0Edit  收藏  举报