|
@@ -5,24 +5,67 @@ if [[ -z "$1" || ! "$1" =~ ^[0-9]+$ ]]; then
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+serverPath=/server #能否获取当前路径作为服务器路径
|
|
|
zone_id=$1
|
|
zone_id=$1
|
|
|
echo -e "获取服务器id: ${zone_id} \n"
|
|
echo -e "获取服务器id: ${zone_id} \n"
|
|
|
|
|
|
|
|
-### 下面xxx修改为需要的路径
|
|
|
|
|
-to_dir=/xxx/data/server_${zone_id}
|
|
|
|
|
-
|
|
|
|
|
-cp -rf /xxx/tpl/server ${to_dir}
|
|
|
|
|
-
|
|
|
|
|
-port=$((8190 + zone_id))
|
|
|
|
|
-
|
|
|
|
|
-# 替换配置文件
|
|
|
|
|
-sed -i "24c\PORT_CLIENT = ${port}" ${to_dir}/script/Config.lua
|
|
|
|
|
-sed -i "28c\DB_NAME = \"ckwy_${zone_id}\"" ${to_dir}/script/Config.lua
|
|
|
|
|
-sed -i "31c\SVR_INDEX = ${zone_id}" ${to_dir}/script/Config.lua
|
|
|
|
|
-sed -i "32c\SVR_NAME = \"s${zone_id}\"" ${to_dir}/script/Config.lua
|
|
|
|
|
|
|
+##################################
|
|
|
|
|
+index1=寻宝
|
|
|
|
|
+index2=服
|
|
|
|
|
+server_name=
|
|
|
|
|
+mapserver() {
|
|
|
|
|
+ server_name=$index1$1$index2
|
|
|
|
|
+ echo $server_name
|
|
|
|
|
+}
|
|
|
|
|
+##################################
|
|
|
|
|
|
|
|
|
|
+### 下面xxx修改为需要的路径
|
|
|
|
|
+to_dir=${serverPath}/bin${zone_id}
|
|
|
|
|
+if [ ! -d "$to_dir" ]; then
|
|
|
|
|
+ # 目录不存在,创建目录
|
|
|
|
|
+ mkdir -p "$to_dir"
|
|
|
|
|
+ cd $to_dir
|
|
|
|
|
+ # 目录不存在,创建目录
|
|
|
|
|
+ mkdir -p "log"
|
|
|
|
|
+ ## 复制 Config ,Main,AdminLogic 三个文件 创建common core excel module 四个软链接
|
|
|
|
|
+ cp -r ${serverPath}/bin/script ${to_dir}
|
|
|
|
|
+ cp -r ${serverPath}/bin/lua51.dll ${to_dir}
|
|
|
|
|
+ cp -r ${serverPath}/bin/logic.exe ${to_dir}
|
|
|
|
|
+ cp -r ${serverPath}/bin/logic ${to_dir}
|
|
|
|
|
+ cp -r ${serverPath}/bin/libgcc_s_dw2-1.dll ${to_dir}
|
|
|
|
|
+
|
|
|
|
|
+ chmod 777 logic
|
|
|
|
|
+
|
|
|
|
|
+ rm -rf ${to_dir}/script/common
|
|
|
|
|
+ rm -rf ${to_dir}/script/excel
|
|
|
|
|
+ rm -rf ${to_dir}/script/module
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #cp ${serverPath}/bin/script/Config.lua ${serverPath}/bin${zone_id}/script/Config.lua
|
|
|
|
|
+ #cp ${serverPath}/bin/script/Main.lua ${serverPath}/bin${zone_id}/script/Main.lua
|
|
|
|
|
+ #cp ${serverPath}/bin/script/AdminLogic.lua ${serverPath}/bin${zone_id}/script/AdminLogic.lua
|
|
|
|
|
+
|
|
|
|
|
+ ln -s ${serverPath}/bin/script/common ${serverPath}/bin${zone_id}/script/common
|
|
|
|
|
+ #ln -s ${serverPath}/bin/script/core ${serverPath}/bin${zone_id}/script/core
|
|
|
|
|
+ ln -s ${serverPath}/bin/script/excel ${serverPath}/bin${zone_id}/script/excel
|
|
|
|
|
+ ln -s ${serverPath}/bin/script/module ${serverPath}/bin${zone_id}/script/module
|
|
|
|
|
+
|
|
|
|
|
+ port=$((8191 + zone_id))
|
|
|
|
|
+ port_admin=$((10000 + zone_id))
|
|
|
|
|
+ database_idx=$((350001 + zone_id))
|
|
|
|
|
+ svr_idx=$((810537 + zone_id))
|
|
|
|
|
+ svrName_idx=$((zone_id - 1))
|
|
|
|
|
+
|
|
|
|
|
+ # 替换配置文件
|
|
|
|
|
+ sed -i "24c\PORT_CLIENT = ${port}" ${to_dir}/script/Config.lua
|
|
|
|
|
+ sed -i "25c\PORT_ADMIN = \"${port_admin}\"" ${to_dir}/script/Config.lua
|
|
|
|
|
+ sed -i "28c\DB_NAME = \"ckwy_fy_S${database_idx}\"" ${to_dir}/script/Config.lua
|
|
|
|
|
+ sed -i "31c\SVR_INDEX = ${svr_idx}" ${to_dir}/script/Config.lua
|
|
|
|
|
+ mapserver $zone_id
|
|
|
|
|
+ echo $server_name
|
|
|
|
|
+ sed -i "32c\SVR_NAME = \"${server_name}\"" ${to_dir}/script/Config.lua
|
|
|
|
|
+fi
|
|
|
|
|
|
|
|
#启动服务
|
|
#启动服务
|
|
|
echo -e "开始启动服务:${zone_id}\n"
|
|
echo -e "开始启动服务:${zone_id}\n"
|
|
|
-cd /data/zone/server_${zone_id} && ./logic
|
|
|
|
|
-
|
|
|
|
|
|
|
+cd $to_dir && ./logic
|