23.08.03-update

main
jinqilin721 2023-08-03 11:59:58 +08:00
parent 8150606afd
commit 307e5e056a
18 changed files with 389 additions and 363 deletions

1
api/SetupCount Normal file
View File

@ -0,0 +1 @@
ok

1
api/getIpAddress Normal file
View File

@ -0,0 +1 @@
127.0.0.1

View File

@ -1 +1 @@
7.7.0
7.7.0

1
api/wpanel/SetupCount Normal file
View File

@ -0,0 +1 @@
ok

View File

@ -0,0 +1,15 @@
[Unit]
Description=BT-Panel - simple and safe web control panel
Documentation=https://www.bt.cn/new/btcode.html
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
ExecStart=/etc/init.d/bt start
ExecReload=/etc/init.d/bt reload
ExecStop=/etc/init.d/bt stop
[Install]
WantedBy=multi-user.target

View File

@ -1,171 +1,185 @@
[{
"name": "Nginx",
"versions": [{
"status": false,
"version": "1.20"
}, {
"status": false,
"version": "1.21"
}, {
"status": false,
"version": "1.19"
}, {
"status": false,
"version": "1.18"
}, {
"status": false,
"version": "-Tengine2.2"
}, {
"status": false,
"version": "openresty"
}],
"type": "Web服务器",
"msg": "Nginx是一款轻量级的Web服务器!",
"shell": "nginx.sh",
"check": "server/nginx/sbin/nginx"
},
{
"name": "Apache",
"versions": [{
"status": false,
"version": "2.4"
}, {
"status": false,
"version": "2.2"
}],
"type": "Web服务器",
"msg": "Apache是世界使用排名第一的Web服务器软件。",
"shell": "httpd.sh",
"check": "server/apache/bin/httpd"
},
{
"name": "MySQL",
"versions": [{
"status": false,
"version": "5.1"
}, {
"status": false,
"version": "5.5"
}, {
"status": false,
"version": "5.6"
}, {
"status": false,
"version": "5.7"
}, {
"status": false,
"version": "8.0"
}, {
"status": false,
"version": "AliSQL"
}, {
"status": false,
"version": "mariadb_10.0"
}, {
"status": false,
"version": "mariadb_10.1"
}],
"type": "数据库",
"msg": "推荐安装!",
"shell": "mysql.sh",
"check": "server/mysql/bin/mysql"
},
{
"name": "Pure-Ftpd",
"versions": [{
"status": false,
"version": "1.0.49"
}],
"type": "FTP服务器",
"msg": "PureFTPd是一款专注于程序健壮和软件安全的免费FTP服务器软件",
"shell": "pure-ftpd.sh",
"check": "server/pure-ftpd/bin/pure-pw"
},
{
"name": "PHP",
"versions": [{
"status": false,
"version": "5.2"
}, {
"status": false,
"version": "5.3"
}, {
"status": false,
"version": "5.4"
}, {
"status": false,
"version": "5.5"
}, {
"status": false,
"version": "5.6"
}, {
"status": false,
"version": "7.0"
}, {
"status": false,
"version": "7.1"
}, {
"status": false,
"version": "7.2"
}, {
"status": false,
"version": "7.3"
}, {
"status": false,
"version": "7.4"
},{
"status": false,
"version": "8.0"
}],
"type": "语言解释器",
"msg": "若非必要,请安装更新的版本!",
"shell": "php.sh",
"check": "server/php/VERSION/bin/php"
},
{
"name": "Tomcat",
"versions": [{
"status": false,
"version": "7"
}, {
"status": false,
"version": "8"
}, {
"status": false,
"version": "9"
}],
"type": "语言解释器",
"msg": "java-ee解释器",
"shell": "tomcat.sh",
"check": "server/tomcat/bin/catalina.sh"
},
{
"name": "phpMyAdmin",
"versions": [{
"status": false,
"version": "4.0"
}, {
"status": false,
"version": "4.4"
}, {
"status": false,
"version": "4.7"
}, {
"status": false,
"version": "4.9"
}, {
"status": false,
"version": "4.8"
}, {
"status": false,
"version": "5.0"
}, {
"status": false,
"version": "5.1"
}],
"type": "数据库工具",
"msg": "Web端MySQL管理工具",
"shell": "phpmyadmin.sh",
"check": "server/phpmyadmin/version.pl"
}
[
{
"name": "Nginx",
"versions": [
{
"status": false,
"version": "1.22"
},
{
"status": false,
"version": "1.21"
},
{
"status": false,
"version": "1.20"
},
{
"status": false,
"version": "1.18"
},
{
"status": false,
"version": "-Tengine2.2"
},
{
"status": false,
"version": "openresty"
}
],
"type": "Web服务器",
"msg": "Nginx是一款轻量级的Web服务器!",
"shell": "nginx.sh",
"check": "server/nginx/sbin/nginx"
},
{
"name": "Apache",
"versions": [
{
"status": false,
"version": "2.4"
}
],
"type": "Web服务器",
"msg": "Apache是世界使用排名第一的Web服务器软件。",
"shell": "httpd.sh",
"check": "server/apache/bin/httpd"
},
{
"name": "MySQL",
"versions": [
{
"status": false,
"version": "5.5"
},
{
"status": false,
"version": "5.6"
},
{
"status": false,
"version": "5.7"
},
{
"status": false,
"version": "8.0"
},
{
"status": false,
"version": "AliSQL"
},
{
"status": false,
"version": "mariadb_10.0"
},
{
"status": false,
"version": "mariadb_10.1"
}
],
"type": "数据库",
"msg": "推荐安装!",
"shell": "mysql.sh",
"check": "server/mysql/bin/mysql"
},
{
"name": "Pure-Ftpd",
"versions": [
{
"status": false,
"version": "1.0.49"
}
],
"type": "FTP服务器",
"msg": "PureFTPd是一款专注于程序健壮和软件安全的免费FTP服务器软件",
"shell": "pure-ftpd.sh",
"check": "server/pure-ftpd/bin/pure-pw"
},
{
"name": "PHP",
"versions": [
{
"status": false,
"version": "5.4"
},
{
"status": false,
"version": "5.6"
},
{
"status": false,
"version": "7.1"
},
{
"status": false,
"version": "7.2"
},
{
"status": false,
"version": "7.3"
},
{
"status": false,
"version": "7.4"
},
{
"status": false,
"version": "8.0"
},
{
"status": false,
"version": "8.1"
}
],
"type": "语言解释器",
"msg": "若非必要,请安装更新的版本!",
"shell": "php.sh",
"check": "server/php/VERSION/bin/php"
},
{
"name": "Tomcat",
"versions": [
{
"status": false,
"version": "7"
},
{
"status": false,
"version": "8"
},
{
"status": false,
"version": "9"
}
],
"type": "语言解释器",
"msg": "java-ee解释器",
"shell": "tomcat.sh",
"check": "server/tomcat/bin/catalina.sh"
},
{
"name": "phpMyAdmin",
"versions": [
{
"status": false,
"version": "4.4"
},
{
"status": false,
"version": "4.9"
},
{
"status": false,
"version": "5.1"
},
{
"status": false,
"version": "5.2"
}
],
"type": "数据库工具",
"msg": "Web端MySQL管理工具",
"shell": "phpmyadmin.sh",
"check": "server/phpmyadmin/version.pl"
}
]

View File

@ -8,7 +8,7 @@ fi
export PATH
LANG=en_US.UTF-8
get_PIP_URL(){
nodes=(https://mirrors.tencent.com/pypi/simple https://mirrors.aliyun.com/pypi/simple https://pypi.tuna.tsinghua.edu.cn/simple https://mirrors.xinac.net/pypi/simple);
nodes=(https://mirrors.tencent.com/pypi/simple https://mirrors.aliyun.com/pypi/simple https://pypi.tuna.tsinghua.edu.cn/simple);
i=1;
for node in ${nodes[@]};
do

View File

@ -10,7 +10,12 @@ export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
get_node_url(){
nodes=(http://dg2.bt.cn http://dg1.bt.cn http://36.133.1.8:5880 http://123.129.198.197 http://38.34.185.130 http://116.213.43.206:5880 http://128.1.164.196);
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn);
if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
fi
tmp_file1=/dev/shm/net_test1.pl
tmp_file2=/dev/shm/net_test2.pl
[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
@ -24,7 +29,7 @@ get_node_url(){
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}')
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1)
if [ "${NODE_STATUS}" == "200" ];then
if [ $TIME_TOTAL -lt 100 ];then
if [ $TIME_TOTAL -lt 300 ];then
if [ $RES -ge 1500 ];then
echo "$RES $node" >> $tmp_file1
fi
@ -35,7 +40,7 @@ get_node_url(){
fi
i=$(($i+1))
if [ $TIME_TOTAL -lt 100 ];then
if [ $TIME_TOTAL -lt 200 ];then
if [ $RES -ge 3000 ];then
break;
fi
@ -47,7 +52,7 @@ get_node_url(){
if [ -z "$NODE_URL" ];then
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
if [ -z "$NODE_URL" ];then
NODE_URL='http://download.bt.cn';
NODE_URL='https://download.bt.cn';
fi
fi
rm -f $tmp_file1
@ -103,23 +108,10 @@ send_check(){
chmod +x /etc/init.d/bt
p_path2=/www/server/panel/class/common.py
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/panel/notpro?version=$p_version
curl -sS --connect-timeout 3 -m 60 https://www.bt.cn/api/panel/notpro?version=$p_version
NODE_URL=""
exit 0;
}
init_check(){
CRACK_URL=(oss.yuewux.com);
for url in ${CRACK_URL[@]};
do
CRACK_INIT=$(cat /etc/init.d/bt |grep ${url})
if [ "${CRACK_INIT}" ];then
rm -rf /www/server/panel/class/*
chattr +i /www/server/panel/class
chattr -R +i /www/server/panel
chattr +i /www
fi
done
}
GetSysInfo(){
if [ "${PM}" = "yum" ]; then
SYS_VERSION=$(cat /etc/redhat-release)
@ -149,9 +141,9 @@ if [ -d "/www/server/phpmyadmin/pma" ];then
rm -rf /www/server/phpmyadmin/pma
EN_CHECK=$(cat /www/server/panel/config/config.json |grep English)
if [ "${EN_CHECK}" ];then
curl https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/update6_en.sh|bash
curl https://download.bt.cn/install/update6_en.sh|bash
else
curl https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/update6.sh|bash
curl https://download.bt.cn/install/update6.sh|bash
fi
echo > /www/server/panel/data/restart.pl
fi
@ -167,3 +159,4 @@ if [ ! $NODE_URL ];then
bt_check
fi

View File

@ -1,88 +0,0 @@
aliyun-python-sdk-core==2.13.35
aliyun-python-sdk-core-v3==2.13.32
aliyun-python-sdk-kms==2.15.0
bcrypt==3.1.7
beautifulsoup4==4.8.2
cachetools==4.0.0
certifi==2019.11.28
cffi==1.15.0
chardet==3.0.4
Click==7.1.2
configobj==5.0.6
configparser==4.0.2
cos-python-sdk-v5==1.9.14
crcmod==1.7
cryptography==36.0.1
Cython==0.29.26
decorator==4.4.1
dicttoxml==1.7.4
dnspython==1.16.0
docker==4.2.0
enum34==1.1.9
Flask==1.1.4
Flask-Session==0.4.0
Flask-SQLAlchemy==2.5.1
future==0.18.2
gevent==21.12.0
gevent-websocket==0.10.1
google-api-core==2.3.2
google-api-python-client==2.33.0
google-auth==2.3.3
google-auth-httplib2==0.1.0
google-auth-oauthlib==0.4.6
google-cloud-core==2.2.1
google-cloud-storage==1.43.0
google-resumable-media==2.1.0
googleapis-common-protos==1.54.0
greenlet==1.1.2
httplib2==0.20.2
idna==2.8
iniparse==0.5
ipaddress==1.0.23
IPy==1.0
itsdangerous==1.1.0
Jinja2==2.11.3
jmespath==0.9.4
kitchen==1.2.6
MarkupSafe==1.1.1
mongo==0.2.0
oauthlib==3.1.1
oss2==2.15.0
paramiko==2.12.0
peewee==3.13.1
Pillow==8.4.0
protobuf==3.19.1
psutil==5.8.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.19
pycryptodome==3.12.0
Pygments==2.7.4
pyinotify==0.9.6
pymongo==3.10.1
PyMySQL==1.0.2
PyNaCl==1.4.0
pyOpenSSL==21.0.0
pyparsing==2.4.6
pyPdf==1.13
PySocks==1.7.1
pytz==2019.3
pyudev==0.22.0
pyxattr==0.7.1
PyYAML==5.4
qiniu==7.5.0
qrcode==7.3.1
redis==4.0.2
requests==2.26.0
requests-file==1.5.1
requests-oauthlib==1.3.0
rsa==4.8
six==1.16.0
soupsieve==1.9.5
SQLAlchemy==1.4.28
supervisor==4.2.2
upyun==2.5.5
uritemplate==3.0.1
urlgrabber==4.1.0
websocket-client==1.2.3
Werkzeug==1.0.1

View File

@ -15,25 +15,27 @@ panel_init(){
panel_path=/www/server/panel
pidfile=$panel_path/logs/panel.pid
cd $panel_path
env_path=$panel_path/pyenv/bin/activate
env_path=$panel_path/pyenv/bin/python3
if [ -f $env_path ];then
source $env_path
pythonV=$panel_path/pyenv/bin/python
chmod -R 700 $panel_path/pyenv/bin
pythonV=$panel_path/pyenv/bin/python3
chmod -R 700 $panel_path/pyenv/bin &> /dev/null
else
pythonV=/usr/bin/python
fi
reg="^#\!$pythonV\$"
is_sed=$(cat $panel_path/BT-Panel|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Panel
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Panel &> /dev/null
fi
is_sed=$(cat $panel_path/BT-Task|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Task
is_python=$(cat $panel_path/BT-Task|grep import)
if [ "${is_python}" != "" ];then
is_sed=$(cat $panel_path/BT-Task|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Task &> /dev/null
fi
fi
chmod 700 $panel_path/BT-Panel
chmod 700 $panel_path/BT-Task
chmod 700 $panel_path/BT-Panel &> /dev/null
chmod 700 $panel_path/BT-Task &> /dev/null
log_file=$panel_path/logs/error.log
task_log_file=$panel_path/logs/task.log
if [ -f $panel_path/data/ssl.pl ];then
@ -53,7 +55,7 @@ get_panel_pids(){
get_task_pids(){
isStart=$(ps aux|grep -E '(task.py|BT-Task)'|grep -v grep|awk '{print $2}'|xargs)
pids=$isStart
arr=$isStart
arr=$isStart
}
panel_start()
@ -64,10 +66,14 @@ panel_start()
fi
get_panel_pids
if [ "$isStart" == '' ];then
rm -f $pidfile
panel_port_check
rm -f $pidfile &> /dev/null
echo -e "Starting Bt-Panel...\c"
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
echo '\n' >> $log_file
if [ $? -ne 0 ];then
$panel_path/BT-Panel > /dev/null 2>&1
else
$panel_path/BT-Panel >> $log_file 2>&1
fi
isStart=""
n=0
while [[ "$isStart" == "" ]];
@ -81,6 +87,7 @@ panel_start()
fi
done
if [ "$isStart" == '' ];then
panel_port_check
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
@ -91,11 +98,16 @@ panel_start()
else
echo "Starting Bt-Panel... Bt-Panel (pid $(echo $isStart)) already running"
fi
get_task_pids
if [ "$isStart" == '' ];then
echo -e "Starting Bt-Tasks... \c"
nohup $panel_path/BT-Task >> $task_log_file 2>&1 &
echo '\n' >> $task_log_file
if [ $? -ne 0 ];then
$panel_path/BT-Task > /dev/null 2>&1
else
$panel_path/BT-Task >> $task_log_file 2>&1
fi
sleep 0.2
get_task_pids
if [ "$isStart" == '' ];then
@ -114,7 +126,7 @@ panel_start()
panel_port_check()
{
is_process=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $1}'|sort|uniq|xargs)
is_process=$(lsof -n -P -i:$port -sTCP:LISTEN|grep LISTEN|grep -v grep|awk '{print $1}'|sort|uniq|xargs)
for pn in ${is_process[@]}
do
if [ "$pn" = "nginx" ];then
@ -164,7 +176,7 @@ panel_port_check()
done
fi
done
is_ports=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
if [ "$is_ports" != '' ];then
kill -9 $is_ports
@ -190,9 +202,9 @@ panel_stop()
do
kill -9 $p &>/dev/null
done
if [ -f $pidfile ];then
rm -f $pidfile
rm -f $pidfile &> /dev/null
fi
echo -e " \033[32mdone\033[0m"
}
@ -206,7 +218,7 @@ panel_status()
else
echo -e "\033[31mBt-Panel not running\033[0m"
fi
get_task_pids
if [ "$isStart" != '' ];then
echo -e "\033[32mBt-Task (pid $isStart) already running\033[0m"
@ -224,14 +236,13 @@ panel_reload()
fi
get_panel_pids
if [ "$isStart" != '' ];then
get_panel_pids
for p in ${arr[@]}
do
kill -9 $p
done
rm -f $pidfile
panel_port_check
echo -e "Reload Bt-Panel.\c";
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
isStart=""
@ -247,6 +258,7 @@ panel_reload()
fi
done
if [ "$isStart" == '' ];then
panel_port_check
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
@ -263,13 +275,31 @@ panel_reload()
install_used()
{
if [ ! -f $panel_path/aliyun.pl ];then
return;
if [ -f $panel_path/aliyun.pl ];then
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
username=$($pythonV $panel_path/tools.py panel $password)
echo "$password" > $panel_path/default.pl
rm -f $panel_path/aliyun.pl
chattr +i $panel_path/default.pl
fi
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
username=$($pythonV $panel_path/tools.py panel $password)
echo "$password" > $panel_path/default.pl
rm -f $panel_path/aliyun.pl
if [ -f $panel_path/php_mysql_auto.pl ];then
bash $panel_path/script/mysql_auto.sh &> /dev/null
bash $panel_path/script/php_auto.sh &> /dev/null
rm -f $panel_path/php_mysql_auto.pl
fi
pip_file=/www/server/panel/pyenv/bin/pip3
python_file=/www/server/panel/pyenv/bin/python3
if [ -f $pip_file ];then
is_rep=$(ls -l /usr/bin/btpip|grep pip3.)
if [ "${is_rep}" != "" ];then
rm -f /usr/bin/btpip /usr/bin/btpython
ln -sf $pip_file /usr/bin/btpip
ln -sf $python_file /usr/bin/btpython
fi
fi
}
error_logs()
@ -288,7 +318,7 @@ case "$1" in
;;
'restart')
panel_stop
sleep 1
sleep 1
panel_start
;;
'reload')
@ -309,16 +339,21 @@ case "$1" in
if [ -f $panel_path/data/domain.conf ];then
address=$(cat $panel_path/data/domain.conf)
fi
auth_path=/login
if [ -f $panel_path/data/admin_path.pl ];then
auth_path=$(cat $panel_path/data/admin_path.pl)
fi
if [ "$address" = "" ];then
address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
address=$(curl -sS --connect-timeout 10 -m 60 https://git.xinac.net/Api/getIpAddress)
fi
pool=http
if [ -f $panel_path/data/ssl.pl ];then
pool=https
fi
pool=http
if [ -f $panel_path/data/ssl.pl ];then
pool=https
fi
if [ "$auth_path" == "/" ];then
auth_path=/login
fi
echo -e "=================================================================="
echo -e "\033[32mBT-Panel default info!\033[0m"
echo -e "=================================================================="
@ -328,9 +363,17 @@ case "$1" in
echo -e "\033[33mWarning:\033[0m"
echo -e "\033[33mIf you cannot access the panel, \033[0m"
echo -e "\033[33mrelease the following port (8888|888|80|443|20|21) in the security group\033[0m"
echo -e "\033[33m注意初始密码仅在首次登录面板前能正确获取其它时间请通过 bt 5 命令修改密码\033[0m"
echo -e "=================================================================="
;;
*)
if [ "${LANG}" != "en_US.UTF-8" ];then
export LANG=en_US.UTF-8 &> /dev/null
fi
if [ "${LC_ALL}" != "en_US.UTF-8" ];then
export LC_ALL=en_US.UTF-8 &> /dev/null
fi
$pythonV $panel_path/tools.py cli $1
;;
esac

View File

@ -15,25 +15,27 @@ panel_init(){
panel_path=/www/server/panel
pidfile=$panel_path/logs/panel.pid
cd $panel_path
env_path=$panel_path/pyenv/bin/activate
env_path=$panel_path/pyenv/bin/python3
if [ -f $env_path ];then
source $env_path
pythonV=$panel_path/pyenv/bin/python
chmod -R 700 $panel_path/pyenv/bin
pythonV=$panel_path/pyenv/bin/python3
chmod -R 700 $panel_path/pyenv/bin &> /dev/null
else
pythonV=/usr/bin/python
fi
reg="^#\!$pythonV\$"
is_sed=$(cat $panel_path/BT-Panel|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Panel
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Panel &> /dev/null
fi
is_sed=$(cat $panel_path/BT-Task|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Task
is_python=$(cat $panel_path/BT-Task|grep import)
if [ "${is_python}" != "" ];then
is_sed=$(cat $panel_path/BT-Task|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Task &> /dev/null
fi
fi
chmod 700 $panel_path/BT-Panel
chmod 700 $panel_path/BT-Task
chmod 700 $panel_path/BT-Panel &> /dev/null
chmod 700 $panel_path/BT-Task &> /dev/null
log_file=$panel_path/logs/error.log
task_log_file=$panel_path/logs/task.log
if [ -f $panel_path/data/ssl.pl ];then
@ -53,7 +55,7 @@ get_panel_pids(){
get_task_pids(){
isStart=$(ps aux|grep -E '(task.py|BT-Task)'|grep -v grep|awk '{print $2}'|xargs)
pids=$isStart
arr=$isStart
arr=$isStart
}
panel_start()
@ -64,10 +66,14 @@ panel_start()
fi
get_panel_pids
if [ "$isStart" == '' ];then
rm -f $pidfile
panel_port_check
rm -f $pidfile &> /dev/null
echo -e "Starting Bt-Panel...\c"
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
echo '\n' >> $log_file
if [ $? -ne 0 ];then
$panel_path/BT-Panel > /dev/null 2>&1
else
$panel_path/BT-Panel >> $log_file 2>&1
fi
isStart=""
n=0
while [[ "$isStart" == "" ]];
@ -81,6 +87,7 @@ panel_start()
fi
done
if [ "$isStart" == '' ];then
panel_port_check
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
@ -91,11 +98,16 @@ panel_start()
else
echo "Starting Bt-Panel... Bt-Panel (pid $(echo $isStart)) already running"
fi
get_task_pids
if [ "$isStart" == '' ];then
echo -e "Starting Bt-Tasks... \c"
nohup $panel_path/BT-Task >> $task_log_file 2>&1 &
echo '\n' >> $task_log_file
if [ $? -ne 0 ];then
$panel_path/BT-Task > /dev/null 2>&1
else
$panel_path/BT-Task >> $task_log_file 2>&1
fi
sleep 0.2
get_task_pids
if [ "$isStart" == '' ];then
@ -114,7 +126,7 @@ panel_start()
panel_port_check()
{
is_process=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $1}'|sort|uniq|xargs)
is_process=$(lsof -n -P -i:$port -sTCP:LISTEN|grep LISTEN|grep -v grep|awk '{print $1}'|sort|uniq|xargs)
for pn in ${is_process[@]}
do
if [ "$pn" = "nginx" ];then
@ -164,7 +176,7 @@ panel_port_check()
done
fi
done
is_ports=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
if [ "$is_ports" != '' ];then
kill -9 $is_ports
@ -190,9 +202,9 @@ panel_stop()
do
kill -9 $p &>/dev/null
done
if [ -f $pidfile ];then
rm -f $pidfile
rm -f $pidfile &> /dev/null
fi
echo -e " \033[32mdone\033[0m"
}
@ -206,7 +218,7 @@ panel_status()
else
echo -e "\033[31mBt-Panel not running\033[0m"
fi
get_task_pids
if [ "$isStart" != '' ];then
echo -e "\033[32mBt-Task (pid $isStart) already running\033[0m"
@ -224,14 +236,13 @@ panel_reload()
fi
get_panel_pids
if [ "$isStart" != '' ];then
get_panel_pids
for p in ${arr[@]}
do
kill -9 $p
done
rm -f $pidfile
panel_port_check
echo -e "Reload Bt-Panel.\c";
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
isStart=""
@ -247,6 +258,7 @@ panel_reload()
fi
done
if [ "$isStart" == '' ];then
panel_port_check
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
@ -263,15 +275,31 @@ panel_reload()
install_used()
{
if [ ! -f $panel_path/aliyun.pl ];then
return;
if [ -f $panel_path/aliyun.pl ];then
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
username=$($pythonV $panel_path/tools.py panel $password)
echo "$password" > $panel_path/default.pl
rm -f $panel_path/aliyun.pl
chattr +i $panel_path/default.pl
fi
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
username=$($pythonV $panel_path/tools.py panel $password)
safe_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
echo "$safe_path" > $panel_path/admin_path.pl
echo "$password" > $panel_path/default.pl
rm -f $panel_path/aliyun.pl
if [ -f $panel_path/php_mysql_auto.pl ];then
bash $panel_path/script/mysql_auto.sh &> /dev/null
bash $panel_path/script/php_auto.sh &> /dev/null
rm -f $panel_path/php_mysql_auto.pl
fi
pip_file=/www/server/panel/pyenv/bin/pip3
python_file=/www/server/panel/pyenv/bin/python3
if [ -f $pip_file ];then
is_rep=$(ls -l /usr/bin/btpip|grep pip3.)
if [ "${is_rep}" != "" ];then
rm -f /usr/bin/btpip /usr/bin/btpython
ln -sf $pip_file /usr/bin/btpip
ln -sf $python_file /usr/bin/btpython
fi
fi
}
error_logs()
@ -290,7 +318,7 @@ case "$1" in
;;
'restart')
panel_stop
sleep 1
sleep 1
panel_start
;;
'reload')
@ -306,36 +334,48 @@ case "$1" in
$pythonV $panel_path/tools.py cli $2
;;
'default')
LOCAL_IP=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
port=$(cat $panel_path/data/port.pl)
password=$(cat $panel_path/default.pl)
if [ -f $panel_path/data/domain.conf ];then
address=$(cat $panel_path/data/domain.conf)
fi
auth_path=/login
if [ -f $panel_path/data/admin_path.pl ];then
auth_path=$(cat $panel_path/data/admin_path.pl)
fi
if [ "$address" = "" ];then
address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
address=$(curl -sS --connect-timeout 10 -m 60 https://git.xinac.net/Api/getIpAddress)
fi
pool=http
if [ -f $panel_path/data/ssl.pl ];then
pool=https
fi
pool=http
if [ -f $panel_path/data/ssl.pl ];then
pool=https
fi
if [ "$auth_path" == "/" ];then
auth_path=/login
fi
LOCAL_IP=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo -e "=================================================================="
echo -e "\033[32mBT-Panel default info!\033[0m"
echo -e "=================================================================="
echo "外网面板地址: $pool://$address:$port$auth_path"
echo "内网面板地址: http://${LOCAL_IP}:$port$auth_path"
echo -e "\033[33m*以下仅为初始默认账户密码若无法登录请执行bt命令重置账户/密码登录\033[0m"
echo "外网面板地址: $pool://$address:$port$auth_path"
echo "内网面板地址: $pool://$LOCAL_IP:$port$auth_path"
echo -e `$pythonV $panel_path/tools.py username`
echo -e "password: $password"
echo -e "\033[33mIf you cannot access the panel,\033[0m"
echo -e "\033[33mrelease the following panel port [${port}] in the security group\033[0m"
echo -e "\033[33m若无法访问面板请检查防火墙/安全组是否有放行面板[${port}]端口\033[0m"
echo -e "\033[33m注意初始密码仅在首次登录面板前能正确获取其它时间请通过 bt 5 命令修改密码\033[0m"
echo -e "=================================================================="
;;
*)
if [ "${LANG}" != "en_US.UTF-8" ];then
export LANG=en_US.UTF-8 &> /dev/null
fi
if [ "${LC_ALL}" != "en_US.UTF-8" ];then
export LC_ALL=en_US.UTF-8 &> /dev/null
fi
$pythonV $panel_path/tools.py cli $1
;;
esac

View File

@ -3,6 +3,9 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
_REPO_URL='https://git.xinac.net'
_BT_REPO_URL=$_REPO_URL'/github/btpanel-v7.7.0/raw/branch/main'
if [ ! -d /www/server/panel/BTPanel ];then
echo "============================================="
echo "错误, 5.x不可以使用此命令升级!"
@ -14,7 +17,7 @@ public_file=/www/server/panel/install/public.sh
publicFileMd5=$(md5sum ${public_file} 2>/dev/null|awk '{print $1}')
md5check="918CC0E14AC92F9D51BFD5CE6A076C36"
if [ "${publicFileMd5}" != "${md5check}" ]; then
wget -O Tpublic.sh https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/public.sh -T 20;
wget -O Tpublic.sh $_BT_REPO_URL/install/public.sh -T 20;
publicFileMd5=$(md5sum Tpublic.sh 2>/dev/null|awk '{print $1}')
if [ "${publicFileMd5}" == "${md5check}" ]; then
\cp -rpa Tpublic.sh $public_file
@ -38,7 +41,7 @@ fi
download_Url=$NODE_URL
setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/api/panel/get_version)
version=$(curl -Ss --connect-timeout 5 -m 2 $_BT_REPO_URL/api/panel/get_version)
if [ "$version" = '' ];then
version='7.7.0'
fi
@ -46,7 +49,7 @@ armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then
version='7.7.0'
fi
wget -T 5 -O /tmp/panel.zip https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/src/LinuxPanel-7.7.0.zip
wget -T 5 -O /tmp/panel.zip $_BT_REPO_URL/install/src/LinuxPanel-7.7.0.zip
dsize=$(du -b /tmp/panel.zip|awk '{print $1}')
if [ $dsize -lt 10240 ];then
echo "获取更新包失败,请稍后更新或联系宝塔运维"
@ -58,7 +61,7 @@ cd $setup_path/server/panel/
check_bt=`cat /etc/init.d/bt`
if [ "${check_bt}" = "" ];then
rm -f /etc/init.d/bt
wget -O /etc/init.d/bt https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/src/bt6.init -T 20
wget -O /etc/init.d/bt $_BT_REPO_URL/install/src/bt6.init -T 20
chmod +x /etc/init.d/bt
fi
rm -f /www/server/panel/*.pyc

View File

@ -3,6 +3,9 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
_REPO_URL='https://git.xinac.net'
_BT_REPO_URL=$_REPO_URL'/github/btpanel-v7.7.0/raw/branch/main'
if [ ! -d /www/server/panel/BTPanel ];then
echo "============================================="
echo "Error, 5.x Can't use this command to upgrade!"
@ -14,7 +17,7 @@ public_file=/www/server/panel/install/public.sh
publicFileMd5=$(md5sum ${public_file} 2>/dev/null|awk '{print $1}')
md5check="918CC0E14AC92F9D51BFD5CE6A076C36"
if [ "${publicFileMd5}" != "${md5check}" ]; then
wget -O Tpublic.sh https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/public.sh -T 20;
wget -O Tpublic.sh $_BT_REPO_URL/install/public.sh -T 20;
publicFileMd5=$(md5sum Tpublic.sh 2>/dev/null|awk '{print $1}')
if [ "${publicFileMd5}" == "${md5check}" ]; then
\cp -rpa Tpublic.sh $public_file
@ -42,7 +45,7 @@ version=$(curl -Ss --connect-timeout 5 -m 2 https://brandnew.aapanel.com/api/pan
if [ "$version" = '' ];then
version='6.8.16'
fi
wget -T 5 -O /tmp/panel.zip https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/src/LinuxPanel-7.7.0.zip
wget -T 5 -O /tmp/panel.zip $_BT_REPO_URL/install/src/LinuxPanel-7.7.0.zip
dsize=$(du -b /tmp/panel.zip|awk '{print $1}')
if [ $dsize -lt 10240 ];then
echo "Failed to get update package, please update or contact aaPanel Operation"
@ -54,7 +57,7 @@ cd $setup_path/server/panel/
check_bt=`cat /etc/init.d/bt`
if [ "${check_bt}" = "" ];then
rm -f /etc/init.d/bt
wget -O /etc/init.d/bt https://git.xinac.net/github/btpanel-v7.7.0/raw/branch/main/install/src/bt6.init -T 20
wget -O /etc/init.d/bt $_BT_REPO_URL/install/src/bt6.init -T 20
chmod +x /etc/init.d/bt
fi
rm -f /www/server/panel/*.pyc