modify mkraidconf.sh

This commit is contained in:
zorro
2010-10-08 11:13:25 +08:00
parent 335bb9802e
commit 39e41d8e38

View File

@@ -1,5 +1,5 @@
#!/bin/sh
. ./functions
if [ $1 == "--help" -o $1 == "-h" ];then
echo "mkraidconf.sh [-h|--help] <conf_path>"
echo " This shell make the raid's configure file, the command follow the path of the file, for example /mnt/etc/mdadm.conf. If in the cdrom suggest to use /mnt/etc/mdadm.conf, and in the disk suggest to use /etc/mdadm.conf.Other path you can try, but it may be not work conveniently for the mdadm."
@@ -8,18 +8,23 @@ if [ $1 == "--help" -o $1 == "-h" ];then
exit 0
fi
if [ -n $1 ]; then
echo "error argument, please look the usage by --help or -h"
if [ -z $1 ]; then
info "empty argument, please look the usage by --help or -h"
exit 1
fi
CONDIR=`dirname $1`
if [ ! -d $CONDIR ]; then
mkdir -p $CONDIR
mkdir -p $CONDIR >>${DEV_LOG} 2>>${DEV_LOG}
if [ $? -ne 0 ]; then
echo "error argument, please look the usage by --help or -h"
info "make directory ${CONDIR} lose, please look the usage by --help or -h"
exit 1
fi
fi
mdadm -Ds -v > $1
mdadm -Ds -v > $1 2>>${DEV_LOG}
if [ $? -eq 0 ];then
info "make $1 allright"
else
info "make $1 lose"
exit 1
fi