Skip to content

Commit

Permalink
修复下载执行代码
Browse files Browse the repository at this point in the history
  • Loading branch information
acooler15 committed Jul 19, 2021
1 parent ac802a1 commit b51c38f
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions Docker/entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ while getopts "t:dc:" opt; do
t)
tag=$OPTARG
;;
d)
d)
daemon="yes"
;;
c)
c)
cron=$OPTARG
;;
\?)
Expand Down Expand Up @@ -51,24 +51,30 @@ fi
# fi
# fi

wget -O /tmp/BiliExp.zip https://archive.fastgit.org/MaxSecurity/BiliExper/archive/master.zip
unzip /tmp/BiliExp.zip -d /tmp
rm /tmp/BiliExp.zip
mv /tmp/BiliExp* /tmp/BiliExp
function download(){
wget -O /tmp/BiliExp.zip https://archive.fastgit.org/MaxSecurity/BiliExper/archive/master.zip
unzip /tmp/BiliExp.zip -d /tmp
rm /tmp/BiliExp.zip
[ -d /tmp/BiliExp ] && rm -rf /tmp/BiliExp
mv /tmp/BiliExp* /tmp/BiliExp

cd /tmp/BiliExp

if [ -f "./Docker/init.sh" ]; then
/bin/sh "./Docker/init.sh";
fi
if [ -f "/tmp/BiliExp/Docker/init.sh" ]; then
/bin/sh "/tmp/BiliExp/Docker/init.sh";
fi
}
# 下载代码
download

#执行代码
if [ $daemon = "yes" ];then
echo "$cron /usr/local/bin/python3 /tmp/BiliExp/BiliExp.py -c /BiliExp/config.json -l /BiliExp/BiliExp.log" > "/etc/crontabs/`whoami`"
/usr/sbin/crond start
while :;do
sleep 24h
# 每24小时下载一次代码(用作更新)
pkill -9 python3
download
done
else
/usr/local/bin/python3 BiliExp.py -c /BiliExp/config.json -l /BiliExp/BiliExp.log
cd /tmp/BiliExp && /usr/local/bin/python3 BiliExp.py -c /BiliExp/config.json -l /BiliExp/BiliExp.log
fi

0 comments on commit b51c38f

Please sign in to comment.