hell script自动搭建简单的iscsi服务器
2013-03-04 17:15
351 查看
#!/bin/bash
#Shell name:conf_iscsi.sh
#
#Program:
# config for iscis
#Author: pero
#Email: perofu.com@gmail.com
#
#History:
# 2012/8/13
#Usage:
#
#If you have any opinion please contact me
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:.
export PATH
if [ $UID -ne 0 ]
then
echo "Run as root"
exit 77
fi
read -p "please input a name of LVG which is really in you system: " lvg
read -p "please input a sizes to be created: " size
read -p "Please input a name for logic volume : " lvn
lvcreate -L ${size}G -n $lvn $lvg
if [ $? -ne 0 ]
then
echo "Please check the $lvn and $lvg are right ... "
exit 77
fi
soft=$(rpm -qa |grep scsi-target |wc -l)
if [ $soft -eq 0 ]
then
yum install scsi-target-* -y
fi
/etc/init.d/tgtd restart &> /dev/null
read -p "Please input a name of tid: " tidn
read -p "Please input a number of tid: " tid
read -p "Please input a number of lun: " lun
tgtadm --lld iscsi --mode target --op new --tid $tid -T $tidn
if [ $? -ne 0 ]
then
echo "Please check the $tid and $tidn are right ... "
exit 77
fi
tgtadm --lld iscsi --mode logicalunit --op new --tid $tid --lun $lun -b /dev/${lvg}/${lvn}
if [ $? -ne 0 ]
then
echo "Please check the $lun is right ... "
exit 77
fi
#read -p "Please input a subnet like " net
#if [ -n $net ]
#then
# tgtadm --lld iscsi --mode target --op bind --tid $tid -I $net
#else
# net=ALL
# tgtadm --lld iscsi --mode target --op bind --tid $tid -I ALL
#fi
tgtadm --lld iscsi --mode target --op bind --tid $tid -I ALL
if [ $? -ne 0 ]
then
echo "Please check the $tid and $tidn are right ... "
exit 77
else
echo "It's ok..."
fi
本文出自 “无咎” 博客,请务必保留此出处http://perofu.blog.51cto.com/6061242/1144575
#Shell name:conf_iscsi.sh
#
#Program:
# config for iscis
#Author: pero
#Email: perofu.com@gmail.com
#
#History:
# 2012/8/13
#Usage:
#
#If you have any opinion please contact me
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:.
export PATH
if [ $UID -ne 0 ]
then
echo "Run as root"
exit 77
fi
read -p "please input a name of LVG which is really in you system: " lvg
read -p "please input a sizes to be created: " size
read -p "Please input a name for logic volume : " lvn
lvcreate -L ${size}G -n $lvn $lvg
if [ $? -ne 0 ]
then
echo "Please check the $lvn and $lvg are right ... "
exit 77
fi
soft=$(rpm -qa |grep scsi-target |wc -l)
if [ $soft -eq 0 ]
then
yum install scsi-target-* -y
fi
/etc/init.d/tgtd restart &> /dev/null
read -p "Please input a name of tid: " tidn
read -p "Please input a number of tid: " tid
read -p "Please input a number of lun: " lun
tgtadm --lld iscsi --mode target --op new --tid $tid -T $tidn
if [ $? -ne 0 ]
then
echo "Please check the $tid and $tidn are right ... "
exit 77
fi
tgtadm --lld iscsi --mode logicalunit --op new --tid $tid --lun $lun -b /dev/${lvg}/${lvn}
if [ $? -ne 0 ]
then
echo "Please check the $lun is right ... "
exit 77
fi
#read -p "Please input a subnet like " net
#if [ -n $net ]
#then
# tgtadm --lld iscsi --mode target --op bind --tid $tid -I $net
#else
# net=ALL
# tgtadm --lld iscsi --mode target --op bind --tid $tid -I ALL
#fi
tgtadm --lld iscsi --mode target --op bind --tid $tid -I ALL
if [ $? -ne 0 ]
then
echo "Please check the $tid and $tidn are right ... "
exit 77
else
echo "It's ok..."
fi
本文出自 “无咎” 博客,请务必保留此出处http://perofu.blog.51cto.com/6061242/1144575
相关文章推荐
- shell script自动搭建简单的dhcp服务器
- Openssh服务器的搭建,并使用PSFTP实现文件自动上传,下载的script命令
- shell script自动搭建简单的linux系统初始化脚本
- shell script自动搭建简单的lamp环境
- shell script自动搭建简单的nfs服务器
- shell script自动搭建简单的pxe服务器
- shell script自动搭建简单的mail服务器(postfix+dovecot)
- shell script自动搭建简单的quota(磁盘配额)
- 用Apache搭建一个简单的服务器
- 搭建一个简单的服务器
- 【简单Web服务器搭建】基于Socket实现的最简单的Web服务器【ASP.NET原理分析】
- win7下简单FTP服务器搭建
- 使用live-server快速搭建本地服务器+自动刷新
- 搭建简单FTP服务器以及过程中容易遇到的几个问题(一)
- Linux(centos)下SVN服务器的搭建及简单配置和使用
- 搭建Pxe服务器无人听应答全自动安装SLES11 SP3系统
- 利用nginx搭建简单图片服务器实现负载均衡
- CI持续集成服务器搭建创建bot服务实现自动构建
- 4步win7下简单FTP服务器搭建…
- 简单记录一下,cenos 7搭建ftp服务器