这种是在生成shell的方式时,都shell的一种封装,尽量在shell用上去,看着简洁点。

#####################################################################                                                                                                     
# usage:                                                                                                                                                                  
# sh start.sh -- start application @dev                                                                                                                                   
# sh start.sh ${env} -- start application @${env}                                                                                                                         
                                                                                                                                                                          
# examples:                                                                                                                                                               
# sh start.sh prod -- use conf/nginx-prod.conf to start OpenResty                                                                                                         
# sh start.sh -- use conf/nginx-dev.conf to start OpenResty                                                                                                               
#####################################################################                                                                                                     
                                                                                                                                                                          
if [ -n "$1" ];then                                                                                                                                                       
    PROFILE="$1"                                                                                                                                                          
else                                                                                                                                                                      
    PROFILE=dev                                                                                                                                                           
fi                                                                                                                                                                        
                                                                                                                                                                          
if  [ $2 = "start" ];then                                                                                                                                                 
    echo "start"                                                                                                                                                          
    sh ./build/start.sh ${PROFILE}                                                                                                                                        
elif [ $2 = "stop" ];then                                                                                                                                                 
    echo "stop"                                                                                                                                                           
    sh ./build/stop.sh ${PROFILE}                                                                                                                                         
elif [ $2 = "reload" ];then                                                                                                                                               
    echo "reload"                                                                                                                                                         
    sh ./build/reload.sh ${PROFILE}                                                                                                                                       
else                                                                                                                                                                      
    echo "Input parameter error!"                                                                                                                                         
fi