代码拉取完成,页面将自动刷新
同步操作将从 威胁猎人/nebula 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
set -e
export LC_ALL=zh_CN.UTF-8
adjust_memory()
{
if [[ $Xmx && $Xmx && $Xmn ]]; then
echo -Xmx=$Xmx -Xmx=$Xmx -Xmn=$Xmn
sed -i s/-Xms.*/-Xms${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmx.*/-Xmx${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmn.*/-Xmn${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
return
fi
memory_size=`free -g | grep 'Mem:' | awk '{print $2}'`
if [[ $memory_size -lt 2 ]]; then
# 小于2g
echo -Xmx=512m -Xmx=512m -Xmn=128m
sed -i s/-Xms.*/-Xms512m/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmx.*/-Xmx512m/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmn.*/-Xmn128m/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
elif [[ $memory_size -lt 16 ]]; then
# 大于2g 小于16g
heap=`expr $memory_size / 4`
Xms=${heap}g
Xmx=${heap}g
Xmn=
if [[ ${heap} -lt 4 ]]; then
Xmn=`expr ${heap} \* 1000 / 4`m
else
Xmn=`expr ${heap} / 4`g
fi
echo -Xmx=$Xmx -Xmx=$Xmx -Xmn=$Xmn
sed -i s/-Xms.*/-Xms${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmx.*/-Xmx${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmn.*/-Xmn${Xms}/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
else
# 大于16g
echo -Xmx=8g -Xmx=8g -Xmn=3g
sed -i s/-Xms.*/-Xms8g/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmx.*/-Xmx8g/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
sed -i s/-Xmn.*/-Xmn3g/ /home/threathunter/nebula/nebula-onlineserver/start_sync.sh
fi
}
adjust_memory
exec "$@"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。