梦里水乡
yjm0573
全部博文(35)
2012年(5)
2010年(6)
2009年(2)
2008年(22)
qutiuip
augustus
shell_1
Phyllis6
zhanggf8
铁乐猫
irockey
阿布晴明
铁匠明空
一罔而情
bzp1982
分类:
2009-12-24 10:13:53
#!/bin/shif [ $# -ne 7 ];then echo "startTask: fail(Param Error)" exit 1fiSRCPATH=/dev/$2BLOCK=$(($4*1024*1024))DISKSIZE=$5DISKTYPE=$6DISKTANKER=$7if [ "$DISKTYPE" = "DISKGENERAL" ]; then DESTPATH=/dev/$3 echo $3 | grep "hd" 2>&1> /dev/null if [ $? == 0 ]; then hdparm -d 1X66 -m 64 -c 3 $DESTPATH fi /home/kdcs/bin/kdcs $SRCPATH $DESTPATH $DISKSIZE 2>&1> /dev/null &elif [ "$DISKTYPE" = "DISKFILE" ]; then DESTPATH=/dev/$3/$1 mkdir -p $DESTPATH /home/kdcs/bin/kdcs $SRCPATH $DESTPATH $DISKSIZE $BLOCK 2>&1> /dev/null &elif [ "$DISKTYPE" = "DISKCOUNTER" ]; then /home/kdcs/bin/mount_disk_tanker $DISKTANKER if [ $? != 0 ]; then echo "startTask: fail(DiskTanker Mount Failed)" exit 1; fi DESTPATH=/home/kdcs/data/$3/$1 mkdir -p $DESTPATH /home/kdcs/bin/kdcs $SRCPATH $DESTPATH $DISKSIZE $BLOCK 2>&1> /dev/null &else echo "startTask: fail(Param Error)" exit 1fiecho "startTask: success"echo -e "\t \t \t \t \n"##############################!/bin/bashCONFIGFILE="/home/kdcs/config/kdcs.conf"CMD=`basename $0`CMD=`echo $CMD|awk -F \. '{print $1}'`echo "$CMD:"DISKTO=`cat $CONFIGFILE |grep disk_typeto|awk -F \" '{print $2}'`SLOTLISTTO=`cat $CONFIGFILE |grep slot_to|grep value |awk -F \" '{print $2}'`DISKFROM=`cat $CONFIGFILE |grep disk_typefrom|awk -F \" '{print $2}'`SLOTLISTFROM=`cat $CONFIGFILE |grep slot_from|grep value |awk -F \" '{print $2}'`#SEQ=1if [ "$DISKFROM" = "IDE" ] || [ "$DISKFROM" = "SCSI" ] || [ "$DISKFROM" = "SAS" ] || [ "$DISKFROM" = "SATA" ] || [ "$DISKFROM" = "USB" ] || [ "$DISKFROM" = "IEE1394" ]; then for SLOT in $SLOTLISTFROM; do DISK=`ls -l /dev/disk/by-path/$SLOT 2>/dev/null|awk -F "->" '{print $2}'|awk -F / '{print $3}'`# DISK=$SLOT DISKMODEL=`udevinfo -q all -n $DISK 2>/dev/null |grep ID_MODEL \ |awk -F \= '{print $2}'` DISKSERIAL=`udevinfo -q all -n $DISK 2>/dev/null |grep ID_SERIAL= \ |awk -F \= '{print $2}' ` DISKPLACE=`udevinfo -q all -n $DISK 2>/dev/null |grep P:|awk '{print $2}'` if [ -z "$DISKPLACE" ];then continue; fi DISKSIZE=`cat /sys$DISKPLACE/size 2>/dev/null` if [ -n "$DISKSIZE" ]; then DISKSIZE=$(($DISKSIZE*512)) fi echo "DISK:1,$DISK,$DISKMODEL,$DISKSERIAL,$DISKSIZE"# SEQ=`expr $SEQ + 1` done fiif [ "$DISKTO" = "IDE" ] || [ "$DISKTO" = "SCSI" ] || [ "$DISKTO" = "SAS" ] || [ "$DISKTO" = "SATA" ] || [ "$DISKTO" = "USB" ] ;then for SLOT in $SLOTLISTTO; do DISK=`ls -l /dev/disk/by-path/$SLOT 2>/dev/null|awk -F "->" '{print $2}'|awk -F / '{print $3}'`# DISK=$SLOT DISKMODEL=`udevinfo -q all -n $DISK 2>/dev/null |grep ID_MODEL \ |awk -F \= '{print $2}'` DISKSERIAL=`udevinfo -q all -n $DISK 2>/dev/null |grep ID_SERIAL= \ |awk -F \= '{print $2}' ` DISKPLACE=`udevinfo -q all -n $DISK 2>/dev/null |grep P:|awk '{print $2}'` if [ -z "$DISKPLACE" ]; then continue fi DISKSIZE=`cat /sys$DISKPLACE/size 2>/dev/null` if [ -n "$DISKSIZE" ]; then DISKSIZE=$(($DISKSIZE*512)) fi echo "DISK:2,$DISK,$DISKMODEL,$DISKSERIAL,$DISKSIZE"# SEQ=`expr $SEQ + 1` donefiecho -e "\t \t \t \t \n
上一篇:Variable的定义
下一篇:system v 消息队列简单代码
登录 注册