forked from TechXueXi/TechXueXi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
61 lines (54 loc) · 2 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
update() {
echo "检查更新"
git -C /xuexi/code/TechXueXi pull $Sourcepath $pullbranche
echo "检查更新完毕"
cp /xuexi/code/TechXueXi/*.sh /xuexi
cp -r /xuexi/code/TechXueXi/SourcePackages/* /xuexi
echo "下载更新"
git -C /xuexi/code/TechXueXi pull $Sourcepath $pullbranche
echo "下载完毕"
cp -r /xuexi/code/TechXueXi/SourcePackages/* /xuexi
echo "更新完成"
}
if [[ ${pullbranche} == "developing" ]]; then
echo "当前处于开发模式,自动更新"
update
fi
#echo "检查更新"
#git -C /xuexi/code/TechXueXi pull $Sourcepath $pullbranche
#echo "检查更新完毕"
#cp -r /xuexi/code/TechXueXi/SourcePackages/* /xuexi
#if ! git -C /xuexi/code/TechXueXi config pull.ff only; then
# rm -rf /xuexi/code/TechXueXi
# cd /xuexi/code/ && git clone -b ${pullbranche} ${Sourcepath}
#fi
printenv >>/etc/environment
touch /var/log/cron.log
if [ "${Pushmode}" = "5" ]; then
echo "当前模式为网页控制台模式,即将启动守护 -- xuexitg"
sleep 1
supervisord -c /etc/supervisord.conf
# nohup /usr/local/bin/python /xuexi/telegramListener.py >> /xuexi/user/tg_listener.log 2>&1 &
sleep 1
supervisorctl start xuexitg
fi
if [ "${Pushmode}" = "2" ]; then
nohup /usr/local/bin/python /xuexi/wechatListener.py >> /xuexi/user/wechat_listener.log 2>&1 &
fi
if [ "${Pushmode}" = "6" ]; then
echo "当前模式为网页控制台模式,即将启动守护 -- xuexiweb"
: > /var/log/xuexi-web.log
sleep 1
supervisord -c /etc/supervisord.conf
sleep 1
# nohup /usr/local/bin/python /xuexi/telegramListener.py >> /xuexi/user/tg_listener.log 2>&1 &
sleep 1
# nohup /usr/local/bin/python /xuexi/telegramListener.py >> /xuexi/user/tg_listener.log 2>&1 &
supervisorctl start xuexiweb
tail -f /var/log/xuexi-web.log &
fi
./run.sh 2>&1 &
echo -e "$CRONTIME $USER /xuexi/run.sh >> /var/log/cron.log 2>&1\n#empty line" >/etc/cron.d/mycron
crontab /etc/cron.d/mycron
cron && tail -f /var/log/cron.log