Skip to content

Commit 386b52c

Browse files
committedMar 23, 2022
调整启动文件逻辑
1 parent 16d20f1 commit 386b52c

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed
 

‎init.sh

+25-16
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ panel_init(){
1515
panel_path=/www/server/panel
1616
pidfile=$panel_path/logs/panel.pid
1717
cd $panel_path
18-
env_path=$panel_path/pyenv/bin/activate
18+
env_path=$panel_path/pyenv/bin/python3
1919
if [ -f $env_path ];then
20-
source $env_path
21-
pythonV=$panel_path/pyenv/bin/python
20+
pythonV=$panel_path/pyenv/bin/python3
2221
chmod -R 700 $panel_path/pyenv/bin
2322
else
2423
pythonV=/usr/bin/python
@@ -67,7 +66,7 @@ panel_start()
6766
rm -f $pidfile
6867
panel_port_check
6968
echo -e "Starting Bt-Panel...\c"
70-
nohup $panel_path/BT-Panel >> /dev/null 2>&1 &
69+
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
7170
isStart=""
7271
n=0
7372
while [[ "$isStart" == "" ]];
@@ -263,21 +262,30 @@ panel_reload()
263262

264263
install_used()
265264
{
266-
if [ ! -f $panel_path/aliyun.pl ];then
267-
return;
265+
if [ -f $panel_path/aliyun.pl ];then
266+
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
267+
username=$($pythonV $panel_path/tools.py panel $password)
268+
echo "$password" > $panel_path/default.pl
269+
rm -f $panel_path/aliyun.pl
268270
fi
269-
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
270-
username=$($pythonV $panel_path/tools.py panel $password)
271-
echo "$password" > $panel_path/default.pl
272-
rm -f $panel_path/aliyun.pl
273271

274-
if [ ! -f $panel_path/php_mysql_auto.pl ];then
275-
return;
272+
if [ -f $panel_path/php_mysql_auto.pl ];then
273+
bash $panel_path/script/mysql_auto.sh &> /dev/null
274+
bash $panel_path/script/php_auto.sh &> /dev/null
275+
rm -f $panel_path/php_mysql_auto.pl
276276
fi
277277

278-
bash $panel_path/script/mysql_auto.sh &> /dev/null
279-
bash $panel_path/script/php_auto.sh &> /dev/null
280-
rm -f $panel_path/php_mysql_auto.pl
278+
pip_file=/www/server/panel/pyenv/bin/pip3
279+
python_file=/www/server/panel/pyenv/bin/python3
280+
if [ -f $pip_file ];then
281+
is_rep=$(ls -l /usr/bin/btpip|grep pip3.)
282+
if [ "${is_rep}" != "" ];then
283+
rm -f /usr/bin/btpip /usr/bin/btpython
284+
ln -sf $pip_file /usr/bin/btpip
285+
ln -sf $python_file /usr/bin/btpython
286+
fi
287+
fi
288+
281289
}
282290

283291
error_logs()
@@ -296,7 +304,7 @@ case "$1" in
296304
;;
297305
'restart')
298306
panel_stop
299-
sleep 1
307+
sleep 1
300308
panel_start
301309
;;
302310
'reload')
@@ -348,3 +356,4 @@ case "$1" in
348356
$pythonV $panel_path/tools.py cli $1
349357
;;
350358
esac
359+

0 commit comments

Comments
 (0)
Please sign in to comment.