位置参数,带默认值
#!/bin/bash
env=${1}
backend_package_name=${2}
backend_encode_salt=${3}
init_server_mem=${4}
max_server_mem=${5}
if [ -z "$init_server_mem" ];then
init_server_mem=2g
fi
if [ -z "$max_server_mem" ];then
max_server_mem=2g
fi
if [ $# -lt 3 ]; then
echo "[ERROR] No enough arguments. Please run script as bash build.sh <env> <backend_package_name> <backend_port> <build_prefix> <backend_encode_salt>"
exit 1
fi
echo "nohup java -jar -Xms$init_server_mem -Xmx$max_server_mem -Djasypt.encryptor.password=$backend_encode_salt -Dspring.profiles.active=$env $backend_package$
网友评论