mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:46:06 +08:00
完善shell调用
This commit is contained in:
parent
74a2b56abc
commit
da54a78d6a
|
@ -35,9 +35,9 @@ python和javaScript的定时任务管理面板
|
|||
|
||||
## 多谢
|
||||
|
||||
* [https://github.com/nevinee/jd_shell](https://github.com/nevinee/jd_shell)
|
||||
* [nevinee](https://gitee.com/evine)
|
||||
|
||||
* [https://github.com/alseambusher/crontab-ui](https://github.com/alseambusher/crontab-ui)
|
||||
* [crontab-ui](https://github.com/alseambusher/crontab-ui)
|
||||
|
||||
* [Ant Design](https://ant.design)
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ import CronService from '../services/cron';
|
|||
const initData = [
|
||||
{
|
||||
name: '更新面板',
|
||||
command: `sleep ${randomSchedule(
|
||||
60,
|
||||
1,
|
||||
)} && git_pull >> $QL_DIR/log/git_pull.log 2>&1`,
|
||||
command: `sleep ${randomSchedule(60, 1)} && ql update`,
|
||||
schedule: `${randomSchedule(60, 1)} ${randomSchedule(
|
||||
24,
|
||||
7,
|
||||
|
@ -17,44 +14,20 @@ const initData = [
|
|||
},
|
||||
{
|
||||
name: 'build面板',
|
||||
command: 'rebuild >> ${QL_DIR}/log/rebuild.log 2>&1',
|
||||
command: 'ql rebuild',
|
||||
schedule: '30 7 */7 * *',
|
||||
status: CrontabStatus.disabled,
|
||||
},
|
||||
{
|
||||
name: '自定义仓库',
|
||||
command: `sleep ${randomSchedule(
|
||||
60,
|
||||
1,
|
||||
)} && diy https://ghproxy.com/https://github.com/whyour/hundun.git "quanx/jx|quanx/jd" tokens >> $QL_DIR/log/diy_pull.log 2>&1`,
|
||||
schedule: `${randomSchedule(60, 1)} ${randomSchedule(
|
||||
24,
|
||||
6,
|
||||
).toString()} * * *`,
|
||||
status: CrontabStatus.idle,
|
||||
},
|
||||
{
|
||||
name: '互助码导出',
|
||||
command: 'export_sharecodes',
|
||||
schedule: '48 5 * * *',
|
||||
status: CrontabStatus.idle,
|
||||
},
|
||||
{
|
||||
name: '删除日志',
|
||||
command: 'rm_log >/dev/null 2>&1',
|
||||
command: 'ql rmlog 7',
|
||||
schedule: '30 7 */7 * *',
|
||||
status: CrontabStatus.disabled,
|
||||
},
|
||||
{
|
||||
name: '重置密码',
|
||||
command: 'js resetpwd',
|
||||
schedule: '33 6 */7 * *',
|
||||
status: CrontabStatus.disabled,
|
||||
},
|
||||
{
|
||||
name: '运行所有脚本(慎用)',
|
||||
command: 'js runall',
|
||||
schedule: '33 6 */7 * *',
|
||||
name: '互助码',
|
||||
command: 'ql code',
|
||||
schedule: '30 7 */7 * *',
|
||||
status: CrontabStatus.disabled,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -2,18 +2,7 @@
|
|||
set -e
|
||||
|
||||
echo -e "======================1. 初始化命令========================\n"
|
||||
dir_shell=/ql/shell/
|
||||
dir_root=$(
|
||||
cd $dir_shell
|
||||
cd ..
|
||||
pwd
|
||||
)
|
||||
|
||||
. $dir_shell/share.sh
|
||||
|
||||
detect_termux
|
||||
detect_macos
|
||||
define_cmd
|
||||
link_shell
|
||||
echo
|
||||
|
||||
|
|
|
@ -1,35 +1,95 @@
|
|||
## Version: v2.0.0
|
||||
## Date: 2021-04-07
|
||||
## Update Content: 新一版qinglong。
|
||||
## Update Content: 新一版青龙。
|
||||
|
||||
## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新
|
||||
|
||||
## 需组合的环境变量列表,env_name需要和var_name一一对应
|
||||
env_name=(
|
||||
JD_COOKIE
|
||||
FRUITSHARECODES
|
||||
PETSHARECODES
|
||||
PLANT_BEAN_SHARECODES
|
||||
DREAM_FACTORY_SHARE_CODES
|
||||
DDFACTORY_SHARECODES
|
||||
JDZZ_SHARECODES
|
||||
JDJOY_SHARECODES
|
||||
JXNC_SHARECODES
|
||||
BOOKSHOP_SHARECODES
|
||||
JD_CASH_SHARECODES
|
||||
JDSGMH_SHARECODES
|
||||
JDCFD_SHARECODES
|
||||
JDHEALTH_SHARECODES
|
||||
)
|
||||
var_name=(
|
||||
Cookie
|
||||
ForOtherFruit
|
||||
ForOtherPet
|
||||
ForOtherBean
|
||||
ForOtherDreamFactory
|
||||
ForOtherJdFactory
|
||||
ForOtherJdzz
|
||||
ForOtherJoy
|
||||
ForOtherJxnc
|
||||
ForOtherBookShop
|
||||
ForOtherCash
|
||||
ForOtherSgmh
|
||||
ForOtherCfd
|
||||
ForOtherHealth
|
||||
)
|
||||
|
||||
## 临时屏蔽某个Cookie
|
||||
## 多个Cookie编号以半角的空格分隔,两侧一对半角双引号,使用此功能后,在运行脚本时账户编号将发生变化
|
||||
## 举例1:TempBlockCookie="2" 临时屏蔽掉Cookie2
|
||||
## 举例2:TempBlockCookie="2 4" 临时屏蔽掉Cookie2和Cookie4
|
||||
TempBlockCookie=""
|
||||
## 所有有互助码的活动,把脚本名称列在 name_js 中,对应 config.sh 中互助码后缀列在 name_config 中,中文名称列在 name_chinese 中。
|
||||
## name_js、name_config 和 name_chinese 中的三个名称必须一一对应。
|
||||
name_js=(
|
||||
jd_fruit
|
||||
jd_pet
|
||||
jd_plantBean
|
||||
jd_dreamFactory
|
||||
jd_jdfactory
|
||||
jd_jdzz
|
||||
jd_crazy_joy
|
||||
jd_jxnc
|
||||
jd_bookshop
|
||||
jd_cash
|
||||
jd_sgmh
|
||||
jd_cfd
|
||||
jd_health
|
||||
)
|
||||
name_config=(
|
||||
Fruit
|
||||
Pet
|
||||
Bean
|
||||
DreamFactory
|
||||
JdFactory
|
||||
Jdzz
|
||||
Joy
|
||||
Jxnc
|
||||
BookShop
|
||||
Cash
|
||||
Sgmh
|
||||
Cfd
|
||||
Health
|
||||
)
|
||||
name_chinese=(
|
||||
东东农场
|
||||
东东萌宠
|
||||
京东种豆得豆
|
||||
京喜工厂
|
||||
东东工厂
|
||||
京东赚赚
|
||||
crazyJoy任务
|
||||
京喜农场
|
||||
口袋书店
|
||||
签到领现金
|
||||
闪购盲盒
|
||||
京喜财富岛
|
||||
东东健康社区
|
||||
)
|
||||
|
||||
## 如果只是想要屏蔽某个账号不跑某一些脚本,可以参考下面 case 这个命令的例子来控制,case的条件中请输入脚本从scripts目录出发的相对路径,也就是在crontab.list中的task命令后面的脚本路径是什么,这里就填入什么
|
||||
## case $1 in
|
||||
## lxk0301_jd_scripts/jd_fruit.js)
|
||||
## TempBlockCookie="5" # 账号5不玩lxk0301_jd_scripts下的jd_fruit.js
|
||||
## ;;
|
||||
## lxk0301_jd_scripts/jd_dreamFactory.js | whyour_hundun/quanx/didi.js)
|
||||
## TempBlockCookie="2" # 账号2不玩lxk0301_jd_scripts下的jd_dreamFactory.js和whyour_hundun下子文件夹quanx中的didi.js
|
||||
## ;;
|
||||
## lxk0301_jd_scripts/jd_jdzz.js | whyour_hundun/quanx/jx_factory.js)
|
||||
## TempBlockCookie="3 6" # 账号3、账号6不玩lxk0301_jd_scripts下的jd_jdzz.js和whyour_hundun下子文件夹quanx中的jx_factory.js
|
||||
## ;;
|
||||
## esac
|
||||
|
||||
|
||||
## 在运行 update 命令时,是否自动删除失效的脚本与定时任务
|
||||
## 在运行 ql repo 命令时,是否自动删除失效的脚本与定时任务
|
||||
AutoDelCron="true"
|
||||
|
||||
|
||||
## 在运行 update 命令时,是否自动增加新的本地定时任务
|
||||
## 在运行 ql repo 命令时,是否自动增加新的本地定时任务
|
||||
AutoAddCron="true"
|
||||
|
||||
## 在运行 task 命令时,随机延迟启动任务的最大延迟时间
|
||||
|
@ -38,7 +98,16 @@ AutoAddCron="true"
|
|||
## 在crontab.list中,除掉每小时上述时间启动的任务外,其他任务在你定义了 RandomDelay 的情况下,一律启用随机延迟,但如果你给某些任务添加了 "now" 或者 "conc",那么这些任务也将无视随机延迟直接启动
|
||||
RandomDelay="300"
|
||||
|
||||
|
||||
## 如果你自己会写shell脚本,并且希望在每次运行 update 命令时,额外运行你的 shell 脚本,请赋值为 "true"
|
||||
## 同时,请务必将你的脚本命名为 extra.sh (只能叫这个文件名),放在 config 目录下
|
||||
EnableExtraShell=""
|
||||
|
||||
## 自动按顺序进行账号间互助(选填) 设置为 true 时,将直接导入code最新日志来进行互助
|
||||
AutoHelpOther=""
|
||||
|
||||
## 定义 jcode 脚本导出的互助码模板样式(选填)
|
||||
## 不填 使用“按编号顺序助力模板”,Cookie编号在前的优先助力
|
||||
## 填 0 使用“全部一致助力模板”,所有账户要助力的码全部一致
|
||||
## 填 1 使用“均等机会助力模板”,所有账户获得助力次数一致
|
||||
## 填 2 使用“随机顺序助力模板”,本套脚本内账号间随机顺序助力,每次生成的顺序都不一致。
|
||||
HelpType=""
|
||||
|
|
760
sample/notify.js
Normal file
760
sample/notify.js
Normal file
File diff suppressed because one or more lines are too long
277
sample/notify.py
Normal file
277
sample/notify.py
Normal file
|
@ -0,0 +1,277 @@
|
|||
#!/usr/bin/env python3
|
||||
# _*_ coding:utf-8 _*_
|
||||
|
||||
import sys
|
||||
import os
|
||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
||||
root_path = os.path.split(cur_path)[0]
|
||||
sys.path.append(root_path)
|
||||
import requests
|
||||
import json
|
||||
import traceback
|
||||
import time
|
||||
import hmac
|
||||
import hashlib
|
||||
import base64
|
||||
import urllib.parse
|
||||
from requests.adapters import HTTPAdapter
|
||||
from urllib3.util import Retry
|
||||
import re
|
||||
|
||||
# 通知服务
|
||||
BARK = '' # bark服务,此参数如果以http或者https开头则判定为自建bark服务; secrets可填;
|
||||
SCKEY = '' # Server酱的SCKEY; secrets可填
|
||||
TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填
|
||||
TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填
|
||||
TG_PROXY_IP = '' # tg机器人的TG_PROXY_IP; secrets可填
|
||||
TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填
|
||||
DD_BOT_ACCESS_TOKEN = '' # 钉钉机器人的DD_BOT_ACCESS_TOKEN; secrets可填
|
||||
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
||||
QYWX_APP = '' # 企业微信应用的QYWX_APP; secrets可填 参考http://note.youdao.com/s/HMiudGkb
|
||||
|
||||
notify_mode = []
|
||||
|
||||
# GitHub action运行需要填写对应的secrets
|
||||
if "BARK" in os.environ and os.environ["BARK"]:
|
||||
BARK = os.environ["BARK"]
|
||||
if "SCKEY" in os.environ and os.environ["SCKEY"]:
|
||||
SCKEY = os.environ["SCKEY"]
|
||||
if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ["TG_USER_ID"]:
|
||||
TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"]
|
||||
TG_USER_ID = os.environ["TG_USER_ID"]
|
||||
if "DD_BOT_ACCESS_TOKEN" in os.environ and os.environ["DD_BOT_ACCESS_TOKEN"] and "DD_BOT_SECRET" in os.environ and os.environ["DD_BOT_SECRET"]:
|
||||
DD_BOT_ACCESS_TOKEN = os.environ["DD_BOT_ACCESS_TOKEN"]
|
||||
DD_BOT_SECRET = os.environ["DD_BOT_SECRET"]
|
||||
if "QYWX_APP" in os.environ and os.environ["QYWX_APP"]:
|
||||
QYWX_APP = os.environ["QYWX_APP"]
|
||||
|
||||
if BARK:
|
||||
notify_mode.append('bark')
|
||||
print("BARK 推送打开")
|
||||
if SCKEY:
|
||||
notify_mode.append('sc_key')
|
||||
print("Server酱 推送打开")
|
||||
if TG_BOT_TOKEN and TG_USER_ID:
|
||||
notify_mode.append('telegram_bot')
|
||||
print("Telegram 推送打开")
|
||||
if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET:
|
||||
notify_mode.append('dingding_bot')
|
||||
print("钉钉机器人 推送打开")
|
||||
if QYWX_APP:
|
||||
notify_mode.append('qywxapp_bot')
|
||||
print("企业微信应用 推送打开")
|
||||
|
||||
def bark(title, content):
|
||||
print("\n")
|
||||
if not BARK:
|
||||
print("bark服务的bark_token未设置!!\n取消推送")
|
||||
return
|
||||
print("bark服务启动")
|
||||
url = None
|
||||
if BARK.startswith('http'):
|
||||
url = f"""{BARK}/{title}/{content}"""
|
||||
else:
|
||||
url = f"""https://api.day.app/{BARK}/{title}/{content}"""
|
||||
response = requests.get(url).json()
|
||||
if response['code'] == 200:
|
||||
print('推送成功!')
|
||||
else:
|
||||
print('推送失败!')
|
||||
|
||||
def serverJ(title, content):
|
||||
print("\n")
|
||||
if not SCKEY:
|
||||
print("server酱服务的SCKEY未设置!!\n取消推送")
|
||||
return
|
||||
print("serverJ服务启动")
|
||||
data = {
|
||||
"text": title,
|
||||
"desp": content.replace("\n", "\n\n")
|
||||
}
|
||||
response = requests.post(f"https://sc.ftqq.com/{SCKEY}.send", data=data).json()
|
||||
if response['errno'] == 0:
|
||||
print('推送成功!')
|
||||
else:
|
||||
print('推送失败!')
|
||||
|
||||
def telegram_bot(title, content):
|
||||
print("\n")
|
||||
bot_token = TG_BOT_TOKEN
|
||||
user_id = TG_USER_ID
|
||||
if not bot_token or not user_id:
|
||||
print("tg服务的bot_token或者user_id未设置!!\n取消推送")
|
||||
return
|
||||
print("tg服务启动")
|
||||
url=f"https://api.telegram.org/bot{TG_BOT_TOKEN}/sendMessage"
|
||||
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
payload = {'chat_id': str(TG_USER_ID), 'text': f'{title}\n\n{content}', 'disable_web_page_preview': 'true'}
|
||||
proxies = None
|
||||
if TG_PROXY_IP and TG_PROXY_PORT:
|
||||
proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT)
|
||||
proxies = {"http": proxyStr, "https": proxyStr}
|
||||
response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json()
|
||||
if response['ok']:
|
||||
print('推送成功!')
|
||||
else:
|
||||
print('推送失败!')
|
||||
|
||||
def dingding_bot(title, content):
|
||||
timestamp = str(round(time.time() * 1000)) # 时间戳
|
||||
secret_enc = DD_BOT_SECRET.encode('utf-8')
|
||||
string_to_sign = '{}\n{}'.format(timestamp, DD_BOT_SECRET)
|
||||
string_to_sign_enc = string_to_sign.encode('utf-8')
|
||||
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) # 签名
|
||||
print('开始使用 钉钉机器人 推送消息...', end='')
|
||||
url = f'https://oapi.dingtalk.com/robot/send?access_token={DD_BOT_ACCESS_TOKEN}×tamp={timestamp}&sign={sign}'
|
||||
headers = {'Content-Type': 'application/json;charset=utf-8'}
|
||||
data = {
|
||||
'msgtype': 'text',
|
||||
'text': {'content': f'{title}\n\n{content}'}
|
||||
}
|
||||
response = requests.post(url=url, data=json.dumps(data), headers=headers, timeout=15).json()
|
||||
if not response['errcode']:
|
||||
print('推送成功!')
|
||||
else:
|
||||
print('推送失败!')
|
||||
|
||||
def qywxapp_bot(title, content):
|
||||
print("\n")
|
||||
if not QYWX_APP:
|
||||
print("企业微信应用的QYWX_APP未设置!!\n取消推送")
|
||||
return
|
||||
print("企业微信应用启动")
|
||||
qywx_app_params = QYWX_APP.split(',')
|
||||
url='https://qyapi.weixin.qq.com/cgi-bin/gettoken'
|
||||
headers= {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
payload = {
|
||||
'corpid': qywx_app_params[0],
|
||||
'corpsecret': qywx_app_params[1],
|
||||
}
|
||||
response = requests.post(url=url, headers=headers, data=json.dumps(payload), timeout=15).json()
|
||||
accesstoken = response["access_token"]
|
||||
html = content.replace("\n", "<br/>")
|
||||
|
||||
options = None
|
||||
if not qywx_app_params[4]:
|
||||
options = {
|
||||
'msgtype': 'text',
|
||||
'text': {
|
||||
content: f'{title}\n\n${content}'
|
||||
}
|
||||
}
|
||||
elif qywx_app_params[4] == '0':
|
||||
options = {
|
||||
'msgtype': 'textcard',
|
||||
'textcard': {
|
||||
title: f'{title}',
|
||||
description: f'{content}',
|
||||
btntxt: '更多'
|
||||
}
|
||||
}
|
||||
elif qywx_app_params[4] == '1':
|
||||
options = {
|
||||
'msgtype': 'text',
|
||||
'text': {
|
||||
content: f'{title}\n\n${content}'
|
||||
}
|
||||
}
|
||||
else:
|
||||
options = {
|
||||
'msgtype': 'mpnews',
|
||||
'mpnews': {
|
||||
'articles': [
|
||||
{
|
||||
'title': f'{title}',
|
||||
'thumb_media_id': f'{qywx_app_params[4]}',
|
||||
'author': '智能助手',
|
||||
'content_source_url': '',
|
||||
'content': f'{html}',
|
||||
'digest': f'{content}'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={accesstoken}"
|
||||
data = {
|
||||
'touser': f'{change_user_id(content)}',
|
||||
'agentid': f'{qywx_app_params[3]}',
|
||||
'safe': '0'
|
||||
}
|
||||
data.update(options)
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
response = requests.post(url=url, headers=headers, data=json.dumps(data)).json()
|
||||
|
||||
if response['errcode'] == 0:
|
||||
print('推送成功!')
|
||||
else:
|
||||
print('推送失败!')
|
||||
|
||||
def change_user_id(desp):
|
||||
qywx_app_params = QYWX_APP.split(',')
|
||||
if qywx_app_params[2]:
|
||||
userIdTmp = qywx_app_params[2].split("|")
|
||||
userId = ""
|
||||
for i in range(len(userIdTmp)):
|
||||
count1 = f"账号{i + 1}"
|
||||
count2 = f"签到号{i + 1}"
|
||||
if re.search(count1, desp) or re.search(count2, desp):
|
||||
userId = userIdTmp[i]
|
||||
if not userId:
|
||||
userId = qywx_app_params[2]
|
||||
return userId
|
||||
else:
|
||||
return "@all"
|
||||
|
||||
def send(title, content):
|
||||
"""
|
||||
使用 bark, telegram bot, dingding bot, serverJ 发送手机推送
|
||||
:param title:
|
||||
:param content:
|
||||
:return:
|
||||
"""
|
||||
for i in notify_mode:
|
||||
if i == 'bark':
|
||||
if BARK:
|
||||
bark(title=title, content=content)
|
||||
else:
|
||||
print('未启用 bark')
|
||||
continue
|
||||
if i == 'sc_key':
|
||||
if SCKEY:
|
||||
serverJ(title=title, content=content)
|
||||
else:
|
||||
print('未启用 Server酱')
|
||||
continue
|
||||
elif i == 'dingding_bot':
|
||||
if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET:
|
||||
dingding_bot(title=title, content=content)
|
||||
else:
|
||||
print('未启用 钉钉机器人')
|
||||
continue
|
||||
elif i == 'telegram_bot':
|
||||
if TG_BOT_TOKEN and TG_USER_ID:
|
||||
telegram_bot(title=title, content=content)
|
||||
else:
|
||||
print('未启用 telegram机器人')
|
||||
continue
|
||||
elif i == 'qywxapp_bot':
|
||||
if QYWX_APP:
|
||||
qywxapp_bot(title=title, content=content)
|
||||
else:
|
||||
print('未启用 企业微信应用推送')
|
||||
continue
|
||||
else:
|
||||
print('此类推送方式不存在')
|
||||
|
||||
def main():
|
||||
send('title', 'content')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
14
sample/package.json
Normal file
14
sample/package.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "dependence",
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"crypto-js": "^4.0.0",
|
||||
"download": "^8.0.0",
|
||||
"got": "^11.5.1",
|
||||
"http-server": "^0.12.3",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
"request": "^2.88.2",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"tunnel": "0.0.6",
|
||||
"ws": "^7.4.3"
|
||||
}
|
1
sample/requirements.txt
Normal file
1
sample/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
requests
|
153
shell/code.sh
Normal file
153
shell/code.sh
Normal file
|
@ -0,0 +1,153 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 导入通用变量与函数
|
||||
. $dir_shell/share.sh
|
||||
|
||||
## 导入配置文件
|
||||
import_config_and_check
|
||||
|
||||
## 生成pt_pin清单
|
||||
gen_pt_pin_array () {
|
||||
local tmp1 tmp2 i pt_pin_temp
|
||||
for ((user_num=1; user_num<=$user_sum; user_num++)); do
|
||||
tmp1=Cookie$user_num
|
||||
tmp2=${!tmp1}
|
||||
i=$(($user_num - 1))
|
||||
pt_pin_temp=$(echo $tmp2 | perl -pe "{s|.*pt_pin=([^; ]+)(?=;?).*|\1|; s|%|\\\x|g}")
|
||||
[[ $pt_pin_temp == *\\x* ]] && pt_pin[i]=$(printf $pt_pin_temp) || pt_pin[i]=$pt_pin_temp
|
||||
done
|
||||
}
|
||||
|
||||
## 导出互助码的通用程序,$1:去掉后缀的脚本名称,$2:config.sh中的后缀,$3:活动中文名称
|
||||
export_codes_sub () {
|
||||
local task_name=$1
|
||||
local config_name=$2
|
||||
local chinese_name=$3
|
||||
local config_name_my=My$config_name
|
||||
local config_name_for_other=ForOther$config_name
|
||||
local i j k m n pt_pin_in_log code tmp_grep tmp_my_code tmp_for_other user_num random_num_list
|
||||
if cd $dir_log/$task_name &>/dev/null && [[ $(ls) ]]; then
|
||||
## 寻找所有互助码以及对应的pt_pin
|
||||
i=0
|
||||
pt_pin_in_log=()
|
||||
code=()
|
||||
pt_pin_and_code=$(ls -r *.log | xargs awk -v var="的$chinese_name好友互助码" 'BEGIN{FS="[( )】]+"; OFS="&"} $3~var {print $2,$4}')
|
||||
for line in $pt_pin_and_code; do
|
||||
pt_pin_in_log[i]=$(echo $line | awk -F "&" '{print $1}')
|
||||
code[i]=$(echo $line | awk -F "&" '{print $2}')
|
||||
let i++
|
||||
done
|
||||
|
||||
## 输出My系列变量
|
||||
if [[ ${#code[*]} -gt 0 ]]; then
|
||||
for ((m=0; m<${#pt_pin[*]}; m++)); do
|
||||
tmp_my_code=""
|
||||
j=$((m + 1))
|
||||
for ((n=0; n<${#code[*]}; n++)); do
|
||||
if [[ ${pt_pin[m]} == ${pt_pin_in_log[n]} ]]; then
|
||||
tmp_my_code=${code[n]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
echo "$config_name_my$j='$tmp_my_code'"
|
||||
done
|
||||
else
|
||||
echo "## 从日志中未找到任何互助码"
|
||||
fi
|
||||
|
||||
## 输出ForOther系列变量
|
||||
if [[ ${#code[*]} -gt 0 ]]; then
|
||||
echo
|
||||
case $HelpType in
|
||||
0) ## 全部一致
|
||||
tmp_for_other=""
|
||||
for ((m=0; m<${#pt_pin[*]}; m++)); do
|
||||
j=$((m + 1))
|
||||
tmp_for_other="$tmp_for_other@\${$config_name_my$j}"
|
||||
done
|
||||
echo "${config_name_for_other}1=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"
|
||||
for ((m=1; m<${#pt_pin[*]}; m++)); do
|
||||
j=$((m + 1))
|
||||
echo "$config_name_for_other$j=\"\${${config_name_for_other}1}\""
|
||||
done
|
||||
;;
|
||||
|
||||
1) ## 均等助力
|
||||
for ((m=0; m<${#pt_pin[*]}; m++)); do
|
||||
tmp_for_other=""
|
||||
j=$((m + 1))
|
||||
for ((n=$m; n<$(($user_sum + $m)); n++)); do
|
||||
[[ $m -eq $n ]] && continue
|
||||
if [[ $((n + 1)) -le $user_sum ]]; then
|
||||
k=$((n + 1))
|
||||
else
|
||||
k=$((n + 1 - $user_sum))
|
||||
fi
|
||||
tmp_for_other="$tmp_for_other@\${$config_name_my$k}"
|
||||
done
|
||||
echo "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"
|
||||
done
|
||||
;;
|
||||
|
||||
2) ## 本套脚本内账号间随机顺序助力
|
||||
for ((m=0; m<${#pt_pin[*]}; m++)); do
|
||||
tmp_for_other=""
|
||||
random_num_list=$(seq $user_sum | sort -R)
|
||||
j=$((m + 1))
|
||||
for n in $random_num_list; do
|
||||
[[ $j -eq $n ]] && continue
|
||||
tmp_for_other="$tmp_for_other@\${$config_name_my$n}"
|
||||
done
|
||||
echo "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"
|
||||
done
|
||||
;;
|
||||
|
||||
*) ## 按编号优先
|
||||
for ((m=0; m<${#pt_pin[*]}; m++)); do
|
||||
tmp_for_other=""
|
||||
j=$((m + 1))
|
||||
for ((n=0; n<${#pt_pin[*]}; n++)); do
|
||||
[[ $m -eq $n ]] && continue
|
||||
k=$((n + 1))
|
||||
tmp_for_other="$tmp_for_other@\${$config_name_my$k}"
|
||||
done
|
||||
echo "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
echo "## 未运行过 $task_name.js 脚本,未产生日志"
|
||||
fi
|
||||
}
|
||||
|
||||
## 汇总输出
|
||||
export_all_codes () {
|
||||
gen_pt_pin_array
|
||||
echo -e "\n# 从日志提取互助码,编号和配置文件中Cookie编号完全对应,如果为空就是所有日志中都没有。\n\n# 即使某个MyXxx变量未赋值,也可以将其变量名填在ForOtherXxx中,jtask脚本会自动过滤空值。\n"
|
||||
echo -n "# 你选择的互助码模板为:"
|
||||
case $HelpType in
|
||||
0)
|
||||
echo "所有账号助力码全部一致。"
|
||||
;;
|
||||
1)
|
||||
echo "所有账号机会均等助力。"
|
||||
;;
|
||||
2)
|
||||
echo "本套脚本内账号间随机顺序助力。"
|
||||
;;
|
||||
*)
|
||||
echo "按账号编号优先。"
|
||||
;;
|
||||
esac
|
||||
for ((i=0; i<${#name_js[*]}; i++)); do
|
||||
echo -e "\n## ${name_chinese[i]}:"
|
||||
export_codes_sub "${name_js[i]}" "${name_config[i]}" "${name_chinese[i]}"
|
||||
done
|
||||
}
|
||||
|
||||
## 执行并写入日志
|
||||
log_time=$(date "+%Y-%m-%d-%H-%M-%S")
|
||||
log_path="$dir_code/$log_time.log"
|
||||
make_dir "$dir_code"
|
||||
export_all_codes | perl -pe "{s|京东种豆|种豆|; s|crazyJoy任务|疯狂的JOY|}" | tee $log_path
|
|
@ -1,16 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 判断环境
|
||||
dir_shell=$(dirname $(readlink -f "$0"))
|
||||
dir_root=$(cd $dir_shell; pwd)
|
||||
|
||||
## 导入通用变量与函数
|
||||
. $dir_shell/share.sh
|
||||
|
||||
## 导入配置文件,检测平台
|
||||
## 导入配置文件
|
||||
import_config_no_check rmlog
|
||||
detect_termux
|
||||
detect_macos
|
||||
|
||||
days=$1
|
||||
|
||||
|
|
109
shell/share.sh
109
shell/share.sh
|
@ -1,13 +1,16 @@
|
|||
## 目录
|
||||
dir_root=/ql
|
||||
dir_shell=$dir_root/shell
|
||||
dir_sample=$dir_root/sample
|
||||
dir_config=$dir_root/config
|
||||
dir_scripts=$dir_root/scripts
|
||||
dir_repo=$dir_root/repo
|
||||
dir_raw=$dir_scripts/raw
|
||||
dir_raw=$dir_root/raw
|
||||
dir_log=$dir_root/log
|
||||
dir_db=$dir_root/db
|
||||
dir_manual_log=$dir_root/manual_log
|
||||
dir_list_tmp=$dir_log/.tmp
|
||||
dir_code=$dir_log/code
|
||||
|
||||
## 文件
|
||||
file_config_sample=$dir_sample/config.sample.sh
|
||||
|
@ -17,6 +20,10 @@ file_config_user=$dir_config/config.sh
|
|||
file_auth_sample=$dir_sample/auth.sample.json
|
||||
file_auth_user=$dir_config/auth.json
|
||||
file_extra_shell=$dir_config/extra.sh
|
||||
file_notify_js_sample=$dir_sample/notify.js
|
||||
file_notify_py_sample=$dir_sample/notify.py
|
||||
file_notify_py=$dir_scripts/notify.py
|
||||
file_notify_js=$dir_scripts/sendNotify.js
|
||||
|
||||
## 清单文件
|
||||
list_crontab_user=$dir_config/crontab.list
|
||||
|
@ -26,14 +33,6 @@ list_own_user=$dir_list_tmp/own_user.list
|
|||
list_own_add=$dir_list_tmp/own_add.list
|
||||
list_own_drop=$dir_list_tmp/own_drop.list
|
||||
|
||||
## 需组合的环境变量列表,env_name需要和var_name一一对应,需要从api取信息
|
||||
env_name=(
|
||||
JD_COOKIE
|
||||
)
|
||||
var_name=(
|
||||
Cookie
|
||||
)
|
||||
|
||||
## 软连接及其原始文件对应关系
|
||||
link_name=(
|
||||
task
|
||||
|
@ -50,9 +49,9 @@ import_config_no_check () {
|
|||
[ -f $file_config_user ] && . $file_config_user
|
||||
}
|
||||
|
||||
## 导入配置文件并校验,$1:任务名称
|
||||
## 导入配置文件并校验
|
||||
import_config_and_check () {
|
||||
import_config_no_check $1
|
||||
import_config_no_check
|
||||
if [[ ! -s $file_cookie ]]; then
|
||||
echo -e "请先配置好Cookie...\n"
|
||||
exit 1
|
||||
|
@ -60,7 +59,6 @@ import_config_and_check () {
|
|||
user_sum=0
|
||||
for line in $(cat $file_cookie); do
|
||||
let user_sum++
|
||||
[[ $user_sum -gt $((3 * 5)) ]] && break
|
||||
eval Cookie${user_sum}="\"$line\""
|
||||
done
|
||||
fi
|
||||
|
@ -148,6 +146,7 @@ fix_config () {
|
|||
make_dir $dir_log
|
||||
make_dir $dir_db
|
||||
make_dir $dir_manual_log
|
||||
make_dir $dir_scripts
|
||||
|
||||
if [ ! -s $file_config_user ]; then
|
||||
echo -e "复制一份 $file_config_sample 为 $file_config_user,随后请按注释编辑你的配置文件:$file_config_user\n"
|
||||
|
@ -167,9 +166,95 @@ fix_config () {
|
|||
echo
|
||||
fi
|
||||
|
||||
if [ ! -s $file_notify_py ]; then
|
||||
echo -e "复制一份 $file_notify_py_sample 为 $file_notify_py\n"
|
||||
cp -fv $file_notify_py_sample $file_notify_py
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ ! -s $file_notify_js ]; then
|
||||
echo -e "复制一份 $file_notify_js_sample 为 $file_notify_js\n"
|
||||
cp -fv $file_notify_js_sample $file_notify_js
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -s /etc/nginx/conf.d/default.conf ]; then
|
||||
echo -e "检测到默认nginx配置文件,删除...\n"
|
||||
rm -f /etc/nginx/conf.d/default.conf
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
## npm install 子程序,判断是否为安卓,判断是否安装有yarn
|
||||
npm_install_sub() {
|
||||
if [ $is_termux -eq 1 ]; then
|
||||
npm install --production --no-save --no-bin-links --registry=https://registry.npm.taobao.org || npm install --production --no-bin-links --no-save
|
||||
elif ! type yarn >/dev/null 2>&1; then
|
||||
npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save
|
||||
else
|
||||
echo -e "检测到本机安装了 yarn,使用 yarn 替代 npm...\n"
|
||||
yarn install --production --network-timeout 1000000000 --registry=https://registry.npm.taobao.org || yarn install --production --network-timeout 1000000000
|
||||
fi
|
||||
}
|
||||
|
||||
## npm install,$1:package.json文件所在路径
|
||||
npm_install_1() {
|
||||
local dir_current=$(pwd)
|
||||
local dir_work=$1
|
||||
|
||||
cd $dir_work
|
||||
echo -e "运行 npm install...\n"
|
||||
npm_install_sub
|
||||
[[ $? -ne 0 ]] && echo -e "\nnpm install 运行不成功,请进入 $dir_work 目录后手动运行 npm install...\n"
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
npm_install_2() {
|
||||
local dir_current=$(pwd)
|
||||
local dir_work=$1
|
||||
|
||||
cd $dir_work
|
||||
echo -e "检测到 $dir_work 的依赖包有变化,运行 npm install...\n"
|
||||
npm_install_sub
|
||||
[[ $? -ne 0 ]] && echo -e "\n安装 $dir_work 的依赖包运行不成功,再次尝试一遍...\n"
|
||||
npm_install_1 $dir_work
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
## 比对两个文件,$1比$2新时,将$1复制为$2
|
||||
diff_and_copy() {
|
||||
local copy_source=$1
|
||||
local copy_to=$2
|
||||
if [ ! -s $copy_to ] || [[ $(diff $copy_source $copy_to) ]]; then
|
||||
cp -f $copy_source $copy_to
|
||||
fi
|
||||
}
|
||||
|
||||
## 更新依赖
|
||||
update_depend() {
|
||||
local dir_current=$(pwd)
|
||||
|
||||
if [ ! -s $dir_scripts/package.json ] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
fi
|
||||
|
||||
[ ! -d $dir_scripts/node_modules ] && npm_install_2 $dir_scripts
|
||||
|
||||
if [ ! -s $dir_scripts/requirements.txt ] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then
|
||||
cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt
|
||||
cd $dir_scripts
|
||||
pip3 install -r $dir_scripts/requirements.txt
|
||||
fi
|
||||
|
||||
[ ! -d $dir_scripts/node_modules ] && npm_install_2 $dir_scripts
|
||||
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
|
||||
detect_termux
|
||||
detect_macos
|
||||
define_cmd
|
||||
fix_config
|
||||
import_config_no_check
|
|
@ -1,9 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 路径
|
||||
dir_shell=$(dirname $(readlink -f "$0"))
|
||||
dir_root=$(cd $dir_shell; pwd)
|
||||
|
||||
## 导入通用变量与函数
|
||||
. $dir_shell/share.sh
|
||||
|
||||
|
@ -13,9 +9,6 @@ combine_sub () {
|
|||
local combined_all=""
|
||||
local tmp1 tmp2
|
||||
for ((i=1; i<=$user_sum; i++)); do
|
||||
for num in $TempBlockCookie; do
|
||||
[[ $i -eq $num ]] && continue 2
|
||||
done
|
||||
local tmp1=$what_combine$i
|
||||
local tmp2=${!tmp1}
|
||||
combined_all="$combined_all&$tmp2"
|
||||
|
@ -65,7 +58,7 @@ gen_array_scripts () {
|
|||
local i="-1"
|
||||
cd $dir_scripts
|
||||
for file in $(ls); do
|
||||
if [ -f $file ] && [[ $file == *.js && $file != sendNotify.js && $file != JD_extra_cookie.js ]]; then
|
||||
if [ -f $file ] && [[ $file == *.js && $file != sendNotify.js ]]; then
|
||||
let i++
|
||||
array_scripts[i]=$(echo "$file" | perl -pe "s|$dir_scripts/||g")
|
||||
array_scripts_name[i]=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1)
|
||||
|
@ -101,7 +94,7 @@ run_normal () {
|
|||
local p1=$1
|
||||
cd $dir_scripts
|
||||
if [ -f $p1 ]; then
|
||||
import_config_and_check "$p1"
|
||||
import_config_and_check
|
||||
define_program "$p1"
|
||||
combine_all
|
||||
[[ $# -eq 1 ]] && random_delay
|
||||
|
@ -121,15 +114,12 @@ run_concurrent () {
|
|||
local p1=$1
|
||||
cd $dir_scripts
|
||||
if [ -f $p1 ]; then
|
||||
import_config_and_check "$p1"
|
||||
import_config_and_check
|
||||
define_program
|
||||
make_dir $dir_log/$p1
|
||||
log_time=$(date "+%Y-%m-%d-%H-%M-%S.%N")
|
||||
echo -e "\n各账号间已经在后台开始并发执行,前台不输入日志,日志直接写入文件中。\n"
|
||||
for ((user_num=1; user_num<=$user_sum; user_num++)); do
|
||||
for num in ${TempBlockCookie}; do
|
||||
[[ $user_num -eq $num ]] && continue 2
|
||||
done
|
||||
combine_one $user_num
|
||||
log_path="$dir_log/$p1/${log_time}_${user_num}.log"
|
||||
$which_program $p1 &>$log_path &
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 文件路径、脚本网址
|
||||
dir_shell=$(dirname $(readlink -f "$0"))
|
||||
dir_root=$(
|
||||
cd $dir_shell
|
||||
cd ..
|
||||
pwd
|
||||
)
|
||||
send_mark=$dir_shell/send_mark
|
||||
|
||||
# 导入通用变量与函数
|
||||
. $dir_shell/share.sh
|
||||
. $dir_shell/api.sh
|
||||
|
||||
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
|
||||
detect_termux
|
||||
detect_macos
|
||||
define_cmd
|
||||
fix_config
|
||||
import_config_no_check "update"
|
||||
get_token
|
||||
|
||||
## 重置仓库remote url,docker专用,$1:要重置的目录,$2:要重置为的网址
|
||||
|
@ -78,14 +65,6 @@ diff_cron() {
|
|||
fi
|
||||
}
|
||||
|
||||
## 更新docker-entrypoint,docker专用
|
||||
update_docker_entrypoint() {
|
||||
if [[ $QL_DIR ]] && [[ $(diff $dir_root/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh) ]]; then
|
||||
cp -f $dir_root/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
chmod 777 /usr/local/bin/docker-entrypoint.sh
|
||||
fi
|
||||
}
|
||||
|
||||
## 检测配置文件版本
|
||||
detect_config_version() {
|
||||
## 识别出两个文件的版本号
|
||||
|
@ -113,61 +92,6 @@ detect_config_version() {
|
|||
fi
|
||||
}
|
||||
|
||||
## npm install 子程序,判断是否为安卓,判断是否安装有yarn
|
||||
npm_install_sub() {
|
||||
if [ $is_termux -eq 1 ]; then
|
||||
npm install --production --no-save --no-bin-links --registry=https://registry.npm.taobao.org || npm install --production --no-bin-links --no-save
|
||||
elif ! type yarn >/dev/null 2>&1; then
|
||||
npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save
|
||||
else
|
||||
echo -e "检测到本机安装了 yarn,使用 yarn 替代 npm...\n"
|
||||
yarn install --production --network-timeout 1000000000 --registry=https://registry.npm.taobao.org || yarn install --production --network-timeout 1000000000
|
||||
fi
|
||||
}
|
||||
|
||||
## npm install,$1:package.json文件所在路径
|
||||
npm_install_1() {
|
||||
local dir_current=$(pwd)
|
||||
local dir_work=$1
|
||||
|
||||
cd $dir_work
|
||||
echo -e "运行 npm install...\n"
|
||||
npm_install_sub
|
||||
[[ $? -ne 0 ]] && echo -e "\nnpm install 运行不成功,请进入 $dir_work 目录后手动运行 npm install...\n"
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
npm_install_2() {
|
||||
local dir_current=$(pwd)
|
||||
local dir_work=$1
|
||||
|
||||
cd $dir_work
|
||||
echo -e "检测到 $dir_work 的依赖包有变化,运行 npm install...\n"
|
||||
npm_install_sub
|
||||
[[ $? -ne 0 ]] && echo -e "\n安装 $dir_work 的依赖包运行不成功,再次尝试一遍...\n"
|
||||
npm_install_1 $dir_work
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
## 比对两个文件,$1比$2新时,将$1复制为$2
|
||||
diff_and_copy() {
|
||||
local copy_source=$1
|
||||
local copy_to=$2
|
||||
if [ ! -s $copy_to ] || [[ $(diff $copy_source $copy_to) ]]; then
|
||||
cp -f $copy_source $copy_to
|
||||
fi
|
||||
}
|
||||
|
||||
## 更新依赖
|
||||
update_depend() {
|
||||
if [ ! -s $dir_scripts/package.json ] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
fi
|
||||
|
||||
[ ! -d $dir_scripts/node_modules ] && npm_install_2 $dir_scripts
|
||||
}
|
||||
|
||||
## 输出是否有新的或失效的定时任务,$1:新的或失效的任务清单文件路径,$2:新/失效
|
||||
output_list_add_drop() {
|
||||
local list=$1
|
||||
|
@ -299,11 +223,12 @@ run_extra_shell() {
|
|||
## 脚本用法
|
||||
usage() {
|
||||
echo -e "本脚本用法:"
|
||||
echo -e "2. $cmd_update update # 只更新qinglong,不会运行extra.sh"
|
||||
echo -e "2. $cmd_update rebuild # 重新编译qinglong,不会运行extra.sh"
|
||||
echo -e "3. $cmd_update raw # 只更新raw文件,不会运行extra.sh"
|
||||
echo -e "4. $cmd_update repo # 更新所有设置的REPO,不会运行extra.sh"
|
||||
echo -e "5. $cmd_update <folder> # 指定scripts脚本目录下某个文件夹名称,只更新这个文件夹中的脚本,当该文件夹已经存在并且是git仓库才可使用此命令,不会运行extra.sh"
|
||||
echo -e "1. $cmd_update update # 更新青龙,并且运行extra.sh"
|
||||
echo -e "2. $cmd_update rebuild # 重新编译青龙,不会运行extra.sh"
|
||||
echo -e "3. $cmd_update raw <fileurl> # 更新单个文件脚本"
|
||||
echo -e "4. $cmd_update repo <repourl> <path> <blacklist> # 更新仓库的脚本"
|
||||
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
|
||||
echo -e "6. $cmd_update code # 获取互助码"
|
||||
}
|
||||
|
||||
## 更新qinglong
|
||||
|
@ -312,11 +237,9 @@ update_qinglong() {
|
|||
git_pull_scripts $dir_root
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
echo -e "\n更新$dir_root成功...\n"
|
||||
make_dir $dir_config
|
||||
cp -f $file_config_sample $dir_config/config.sample.sh
|
||||
update_docker_entrypoint
|
||||
update_depend
|
||||
detect_config_version
|
||||
update_depend
|
||||
else
|
||||
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
||||
fi
|
||||
|
@ -409,6 +332,9 @@ main() {
|
|||
rmlog)
|
||||
source $dir_shell/rmlog.sh "$p2" | tee $log_path
|
||||
;;
|
||||
code)
|
||||
source $dir_shell/code.sh
|
||||
;;
|
||||
*)
|
||||
echo -e "命令输入错误...\n"
|
||||
usage
|
||||
|
|
|
@ -302,24 +302,22 @@ const Crontab = () => {
|
|||
<Menu.Item key="edit" icon={<EditOutlined />}>
|
||||
编辑
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
key="enableordisable"
|
||||
icon={
|
||||
record.status === CrontabStatus.disabled ? (
|
||||
<CheckCircleOutlined />
|
||||
) : (
|
||||
<StopOutlined />
|
||||
)
|
||||
}
|
||||
>
|
||||
{record.status === CrontabStatus.disabled ? '启用' : '禁用'}
|
||||
</Menu.Item>
|
||||
{record.isSystem !== 1 && (
|
||||
<>
|
||||
<Menu.Item
|
||||
key="enableordisable"
|
||||
icon={
|
||||
record.status === CrontabStatus.disabled ? (
|
||||
<CheckCircleOutlined />
|
||||
) : (
|
||||
<StopOutlined />
|
||||
)
|
||||
}
|
||||
>
|
||||
{record.status === CrontabStatus.disabled ? '启用' : '禁用'}
|
||||
</Menu.Item>
|
||||
<Menu.Item key="delete" icon={<DeleteOutlined />}>
|
||||
删除
|
||||
</Menu.Item>
|
||||
</>
|
||||
<Menu.Item key="delete" icon={<DeleteOutlined />}>
|
||||
删除
|
||||
</Menu.Item>
|
||||
)}
|
||||
</Menu>
|
||||
}
|
||||
|
@ -436,6 +434,9 @@ const Crontab = () => {
|
|||
marginLeft,
|
||||
},
|
||||
}}
|
||||
style={{
|
||||
height: '100vh',
|
||||
}}
|
||||
>
|
||||
<Table
|
||||
columns={columns}
|
||||
|
|
Loading…
Reference in New Issue
Block a user