Authored by Rong

add

#/bin/bash
function usage(){
echo "----------------------------------"
echo "参数说明:"
echo "-t : 操作类型"
echo "-f : 父路径"
echo "-c : 文件名"
echo ""
echo "举例:sh git.sh -t \"reset_pull\" -f /opt/jmeter/script -c test.jmx"
echo "----------------------------------"
}
if [[ $# -lt 1 ]];then
usage
exit 1
fi
while getopts "t:f:c:" arg
do
case $arg in
t)
gittype=$OPTARG
;;
f)
fatherPath=$OPTARG
;;
c)
filename=$OPTARG
;;
h)
usage
exit 1
;;
?)
echo "未知的参数!"
exit 1
;;
esac
done
if [[ "$gittype" == "reset_pull" && -n "$fatherPath" ]];then
cd $fatherPath
pwd
git reset --hard origin/master
git pull
fi
if [[ "$gittype" == "add_push" && -n "$fatherPath" && -n "$filename" ]];then
cd $fatherPath
pwd
git add $filename
git commit -m "commit by shell"
git push
fi
... ...
... ... @@ -7,4 +7,4 @@ ps -ef | grep "yohoPerformanceTestAuto_Job.sh" | grep -v grep | cut -c 9-15 | xa
if [ "$1" == "stop" ];then
exit
fi
${basepath}/yohoPerformanceTestAuto_Job.sh 1>/dev/null 2>&1 &
${basepath}/yohoPerformanceTestAuto_Job.sh $1 1>/dev/null 2>&1 &
... ...
... ... @@ -8,7 +8,7 @@ basepath=$(cd `dirname $0`; pwd)
while true
do
${basepath}/yohoPerformanceTestAuto_Gor_InfluxDB.sh
${basepath}/yohoPerformanceTestAuto_Gor_InfluxDB.sh $1 1>/dev/null 2>&1
sleep 7
done
... ...