mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
基础命令重构
1. 移除命令中 bash 依赖 2. jd命令重命名为js 3. 修改默认初始目录 4. 移除冗余代码
This commit is contained in:
parent
43eab41579
commit
8906472ae0
|
@ -11,7 +11,7 @@ const sampleFile = path.join(rootPath, 'sample/config.sh.sample');
|
|||
const crontabFile = path.join(rootPath, 'config/crontab.list');
|
||||
const confBakDir = path.join(rootPath, 'config/bak/');
|
||||
const authConfigFile = path.join(rootPath, 'config/auth.json');
|
||||
const shareCodeDir = path.join(rootPath, 'log/jd_get_share_code/');
|
||||
const shareCodeDir = path.join(rootPath, 'log/share_code/');
|
||||
const diyFile = path.join(rootPath, 'config/diy.sh');
|
||||
const logPath = path.join(rootPath, 'log/');
|
||||
const authError = '错误的用户名密码,请重试';
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
export interface ICommon {
|
||||
_id: string;
|
||||
value: String;
|
||||
name: String;
|
||||
type: Number;
|
||||
}
|
||||
|
||||
export interface ICommonInputDTO {
|
||||
value: String;
|
||||
name: String;
|
||||
type: Number;
|
||||
}
|
||||
|
||||
export enum ShareCodeType {
|
||||
ddFactory = 1,
|
||||
ddXw,
|
||||
jxCfd,
|
||||
jxFactory,
|
||||
jxFactoryTuan,
|
||||
jxNc,
|
||||
jxStory,
|
||||
jxCfdGroup,
|
||||
jdZz,
|
||||
jdZjdTuan,
|
||||
didi,
|
||||
jd818,
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
export interface IContent {
|
||||
author: String;
|
||||
paragraphs: [String];
|
||||
title: String;
|
||||
id: String;
|
||||
created_at: Number;
|
||||
}
|
9
back/types/express/index.d.ts
vendored
9
back/types/express/index.d.ts
vendored
|
@ -1,9 +0,0 @@
|
|||
import { Document, Model } from 'mongoose';
|
||||
import { IContent } from '../../interfaces/IContent';
|
||||
import { ICommon } from '../../interfaces/ICommon';
|
||||
declare global {
|
||||
namespace Models {
|
||||
export type IContentModel = Model<IContent & Document>;
|
||||
export type ICommonModel = Model<ICommon & Document>;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
FROM node:lts-alpine as build
|
||||
LABEL maintainer="whyour"
|
||||
ARG JD_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
||||
ARG JD_BASE_BRANCH=master
|
||||
ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
||||
ARG QL_BASE_BRANCH=master
|
||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
LANG=zh_CN.UTF-8 \
|
||||
SHELL=/bin/bash \
|
||||
PS1="\u@\h:\w \$ " \
|
||||
JD_DIR=/jd
|
||||
QL_DIR=/ql
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk update -f \
|
||||
&& apk upgrade \
|
||||
|
@ -17,21 +17,22 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
|||
make \
|
||||
g++ \
|
||||
yarn \
|
||||
&& git clone -b ${JD_BASE_BRANCH} ${JD_BASE_URL} ${JD_DIR} \
|
||||
&& cd ${JD_DIR} \
|
||||
&& git clone -b ${QL_BASE_BRANCH} ${QL_BASE_URL} ${QL_DIR} \
|
||||
&& cd ${QL_DIR} \
|
||||
&& cp -f .env.example .env \
|
||||
&& yarn --network-timeout 100000
|
||||
FROM node:lts-alpine
|
||||
LABEL maintainer="whyour"
|
||||
ARG JD_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
||||
ARG JD_BASE_BRANCH=master
|
||||
ARG JD_SCRIPTS_URL=https://github.com.cnpmjs.org/RikudouPatrickstar/jd_scripts
|
||||
ARG JD_SCRIPTS_BRANCH=master
|
||||
ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
||||
ARG QL_BASE_BRANCH=master
|
||||
ARG QL_SCRIPTS_URL=https://github.com.cnpmjs.org/RikudouPatrickstar/QL_scripts
|
||||
ARG QL_SCRIPTS_BRANCH=master
|
||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
LANG=zh_CN.UTF-8 \
|
||||
SHELL=/bin/bash \
|
||||
PS1="\u@\h:\w \$ " \
|
||||
JD_DIR=/jd
|
||||
QL_DIR=/ql
|
||||
WORKDIR ${QL_DIR}
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk update -f \
|
||||
&& apk upgrade \
|
||||
|
@ -55,24 +56,26 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
|||
&& echo "Asia/Shanghai" > /etc/timezone \
|
||||
&& touch ~/.bashrc \
|
||||
&& mkdir /run/nginx \
|
||||
&& git clone -b ${JD_BASE_BRANCH} ${JD_BASE_URL} ${JD_DIR} \
|
||||
&& cd ${JD_DIR} \
|
||||
&& git clone -b ${QL_BASE_BRANCH} ${QL_BASE_URL} ${QL_DIR} \
|
||||
&& cd ${QL_DIR} \
|
||||
&& cp -f .env.example .env \
|
||||
&& ln -sf ${JD_DIR}/shell/jd.sh /usr/local/bin/jd \
|
||||
&& ln -sf ${JD_DIR}/shell/git_pull.sh /usr/local/bin/git_pull \
|
||||
&& ln -sf ${JD_DIR}/shell/rm_log.sh /usr/local/bin/rm_log \
|
||||
&& ln -sf ${JD_DIR}/shell/export_sharecodes.sh /usr/local/bin/export_sharecodes \
|
||||
&& ln -sf ${JD_DIR}/shell/git_diy.sh /usr/local/bin/diy \
|
||||
&& ln -sf ${JD_DIR}/shell/notify.sh /usr/local/bin/notify \
|
||||
&& ln -sf ${JD_DIR}/shell/rebuild.sh /usr/local/bin/rebuild
|
||||
COPY --from=build /jd/node_modules /jd/node_modules/
|
||||
RUN cd ${JD_DIR} \
|
||||
&& ln -sf ${QL_DIR}/shell/js.sh /usr/local/bin/js \
|
||||
&& ln -sf ${QL_DIR}/shell/git_pull.sh /usr/local/bin/git_pull \
|
||||
&& ln -sf ${QL_DIR}/shell/rm_log.sh /usr/local/bin/rm_log \
|
||||
&& ln -sf ${QL_DIR}/shell/export_sharecodes.sh /usr/local/bin/export_sharecodes \
|
||||
&& ln -sf ${QL_DIR}/shell/git_diy.sh /usr/local/bin/diy \
|
||||
&& ln -sf ${QL_DIR}/shell/notify.sh /usr/local/bin/notify \
|
||||
&& ln -sf ${QL_DIR}/shell/rebuild.sh /usr/local/bin/rebuild
|
||||
&& cp -f $QL_DIR/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh \
|
||||
&& chmod 777 /usr/local/bin/docker-entrypoint.sh \
|
||||
&& chmod 777 $QL_DIR/shell/*.sh \
|
||||
COPY --from=build /ql/node_modules /ql/node_modules/
|
||||
RUN cd ${QL_DIR} \
|
||||
&& yarn build \
|
||||
&& yarn build-back \
|
||||
&& git clone -b ${JD_SCRIPTS_BRANCH} ${JD_SCRIPTS_URL} ${JD_DIR}/scripts \
|
||||
&& cd ${JD_DIR}/scripts \
|
||||
&& git clone -b ${QL_SCRIPTS_BRANCH} ${QL_SCRIPTS_URL} ${QL_DIR}/scripts \
|
||||
&& cd ${QL_DIR}/scripts \
|
||||
&& npm install \
|
||||
&& npm install -g pm2 \
|
||||
&& rm -rf /root/.npm
|
||||
WORKDIR ${JD_DIR}
|
||||
ENTRYPOINT bash ${JD_DIR}/docker/docker-entrypoint.sh
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
@ -2,34 +2,34 @@
|
|||
set -e
|
||||
|
||||
echo -e "======================1. 检测配置文件========================\n"
|
||||
[ ! -d ${JD_DIR}/config ] && mkdir -p ${JD_DIR}/config
|
||||
[ ! -d ${QL_DIR}/config ] && mkdir -p ${QL_DIR}/config
|
||||
|
||||
if [ ! -s ${JD_DIR}/config/crontab.list ]
|
||||
if [ ! -s ${QL_DIR}/config/crontab.list ]
|
||||
then
|
||||
echo -e "检测到config配置目录下不存在crontab.list或存在但文件为空,从示例文件复制一份用于初始化...\n"
|
||||
cp -fv ${JD_DIR}/sample/crontab.list.sample ${JD_DIR}/config/crontab.list
|
||||
sed -i "s,MY_PATH,${JD_DIR},g" ${JD_DIR}/config/crontab.list
|
||||
sed -i "s,ENV_PATH=,PATH=$PATH,g" ${JD_DIR}/config/crontab.list
|
||||
cp -fv ${QL_DIR}/sample/crontab.list.sample ${QL_DIR}/config/crontab.list
|
||||
sed -i "s,MY_PATH,${QL_DIR},g" ${QL_DIR}/config/crontab.list
|
||||
sed -i "s,ENV_PATH=,PATH=$PATH,g" ${QL_DIR}/config/crontab.list
|
||||
fi
|
||||
crond
|
||||
crontab ${JD_DIR}/config/crontab.list
|
||||
crontab ${QL_DIR}/config/crontab.list
|
||||
echo -e "成功添加定时任务...\n"
|
||||
|
||||
if [ ! -s ${JD_DIR}/config/cookie.sh ]; then
|
||||
if [ ! -s ${QL_DIR}/config/cookie.sh ]; then
|
||||
echo -e "检测到config配置目录下不存在config.sh,从示例文件复制一份用于初始化...\n"
|
||||
touch ${JD_DIR}/config/cookie.sh
|
||||
touch ${QL_DIR}/config/cookie.sh
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ ! -s ${JD_DIR}/config/config.sh ]; then
|
||||
if [ ! -s ${QL_DIR}/config/config.sh ]; then
|
||||
echo -e "检测到config配置目录下不存在config.sh,从示例文件复制一份用于初始化...\n"
|
||||
cp -fv ${JD_DIR}/sample/config.sh.sample ${JD_DIR}/config/config.sh
|
||||
cp -fv ${QL_DIR}/sample/config.sh.sample ${QL_DIR}/config/config.sh
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ ! -s ${JD_DIR}/config/auth.json ]; then
|
||||
if [ ! -s ${QL_DIR}/config/auth.json ]; then
|
||||
echo -e "检测到config配置目录下不存在auth.json,从示例文件复制一份用于初始化...\n"
|
||||
cp -fv ${JD_DIR}/sample/auth.json ${JD_DIR}/config/auth.json
|
||||
cp -fv ${QL_DIR}/sample/auth.json ${QL_DIR}/config/auth.json
|
||||
echo
|
||||
fi
|
||||
|
||||
|
@ -39,29 +39,29 @@ if [ -s /etc/nginx/conf.d/default.conf ]; then
|
|||
echo
|
||||
fi
|
||||
|
||||
cp -fv ${JD_DIR}/docker/front.conf /etc/nginx/conf.d/front.conf
|
||||
cp -fv ${QL_DIR}/docker/front.conf /etc/nginx/conf.d/front.conf
|
||||
|
||||
echo -e "======================2. 启动nginx========================\n"
|
||||
nginx -c /etc/nginx/nginx.conf
|
||||
echo
|
||||
|
||||
echo -e "======================3. 更新源代码========================\n"
|
||||
bash ${JD_DIR}/shell/git_pull.sh
|
||||
git_pull
|
||||
echo
|
||||
|
||||
echo -e "======================4. 启动挂机程序========================\n"
|
||||
CookieConf=${JD_DIR}/config/cookie.sh
|
||||
. ${JD_DIR}/config/config.sh
|
||||
CookieConf=${QL_DIR}/config/cookie.sh
|
||||
. ${QL_DIR}/config/config.sh
|
||||
. ${CookieConf}
|
||||
if [ -s ${CookieConf} ]; then
|
||||
bash ${JD_DIR}/shell/jd.sh hangup 2>/dev/null
|
||||
js hangup 2>/dev/null
|
||||
echo -e "挂机程序启动成功...\n"
|
||||
else
|
||||
echo -e "尚未在Cookie管理中添加一条Cookie,可能是首次部署容器,因此不启动挂机程序...\n"
|
||||
fi
|
||||
|
||||
echo -e "======================5. 启动控制面板========================\n"
|
||||
pm2 start ${JD_DIR}/build/app.js -n panel
|
||||
pm2 start ${QL_DIR}/build/app.js -n panel
|
||||
echo -e "控制面板启动成功...\n"
|
||||
|
||||
echo -e "\n容器启动成功...\n"
|
||||
|
|
|
@ -4,7 +4,7 @@ upstream api {
|
|||
|
||||
server {
|
||||
listen 5700;
|
||||
root /jd/dist;
|
||||
root /ql/dist;
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
location /api {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
## Update Content: 京小兑控制变量,宠汪汪自己内部账户互助变量,环球挑战赛互助变量。
|
||||
|
||||
## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新
|
||||
## 如需更新,请参考WIKI(https://github.com/EvineDeng/jd-base/wiki)中"如何更新配置文件"部分的操作说明,进行智能比对后修改。
|
||||
|
||||
################################## 说明 ##################################
|
||||
## 以下配置中,带有 export 申明的,均由LXK9301大佬定义,详见:https://gitee.com/lxk0301/jd_scripts/blob/master/githubAction.md
|
||||
|
@ -258,7 +257,7 @@ ForOtherJoy6=""
|
|||
## 具体填法及要求详见本文件最下方“互助码填法示例”
|
||||
## 京喜农场助力码为 JSON 格式因此使用单引号,json 格式如下
|
||||
## {"smp":"22bdadsfaadsfadse8a","active":"jdnc_1_btorange210113_2","joinnum":"1"}
|
||||
## 助力码获取可以通过 bash jd jd_get_share_code now 命令获取
|
||||
## 助力码获取可以通过 js jd_get_share_code now 命令获取
|
||||
## 注意:京喜农场 种植种子发生变化的时候,互助码也会变!!
|
||||
MyJxnc1=''
|
||||
MyJxnc2=''
|
||||
|
@ -598,17 +597,3 @@ EnableExtraShell=""
|
|||
# ForOtherFruit4="${MyFruit1}@${MyFruit2}@${MyFruit3}@${MyFruitC}@${MyFruit6}@${MyFruitA}" # 解释同上,东东农场实际上只能助力3次
|
||||
# ForOtherFruit5="${MyFruit1}@${MyFruit2}@${MyFruit3}@${MyFruitB}@${MyFruit4}@${MyFruit6}@${MyFruitC}@${MyFruitA}"
|
||||
# ForOtherFruit6="${MyFruit1}@${MyFruit2}@${MyFruit3}@${MyFruitA}@${MyFruit4}@${MyFruit5}@${MyFruitC}"
|
||||
|
||||
|
||||
################################## 额外的环境变量(选填) ##################################
|
||||
## 请在以下补充你需要用到的额外的环境变量,形式:export 变量名="变量值"
|
||||
|
||||
################################## 喜玛拉亚极速版 #########################################
|
||||
## 所需要的环境变量请去作者地址查看,因为是京东脚本为主,所以在京东缺失cookie的情况下此脚本也不会运行。仓库地址:https://github.com/Zero-S1/xmly_speed
|
||||
export XMLY_SPEED_COOKIE=""
|
||||
|
||||
###############################联通,爱奇艺,bilibili,52pojie#############################
|
||||
##请至config文件夹中相应的.json文件进行查看。参考仓库地址:https://github.com/kangwenhang/jd_docker2/tree/AutoSignMachine(非原仓库地址)
|
||||
##注意:.json文件配置完成后请删除内容注释那一行。
|
||||
##联通脚本更新,请于config文件中创建.env文件并且填写参数(注意:联通的json文件不用配置,但不可以删除,必须保留并且删除第一行注释)
|
||||
##env文件参考:https://github.com/dockere/jd-base/blob/py/sample/.env.sample
|
||||
|
|
|
@ -1,67 +1,59 @@
|
|||
# 更新shell及面板代码
|
||||
55 2,13 * * * git_pull >> ${QL_DIR}/log/git_pull.log 2>&1
|
||||
# 更新你需要的仓库的代码
|
||||
55 2,13 * * * bash git_pull >> ${JD_DIR}/log/git_pull.log 2>&1
|
||||
30 * * * * bash diy i-chenzhe qx >> ${JD_DIR}/log/diy_pull.log 2>&1
|
||||
30 * * * * diy i-chenzhe qx >> ${QL_DIR}/log/diy_pull.log 2>&1
|
||||
# 重新build面板
|
||||
# 30 7 */7 * * bash rebuild >> ${JD_DIR}/log/rebuild.log 2>&1
|
||||
# 30 7 */7 * * rebuild >> ${QL_DIR}/log/rebuild.log 2>&1
|
||||
|
||||
# 删除 RmLogDaysAgo 指定天数以前的旧日志,本行为不记录日志
|
||||
57 13 * * * bash rm_log >/dev/null 2>&1
|
||||
57 13 * * * rm_log >/dev/null 2>&1
|
||||
|
||||
# 导出所有互助码清单,日志在log/export_sharecodes下
|
||||
48 5 * * * bash export_sharecodes
|
||||
48 5 * * * export_sharecodes
|
||||
|
||||
# 重启挂机脚本,挂机脚本可以随容器启动而启动,建议需要重启挂机程序时直接重启容器,如实在不想通过重启容器而重启挂机程序,可以解除下一行注释
|
||||
# 33 13 * * * bash jd hangup
|
||||
|
||||
# 另外的js脚本,若需使用,请去掉注释(包括52破解,bilibili,爱奇艺,联通)
|
||||
#10 13 * * * bash jd 52pojie
|
||||
#*/30 7-22 * * * bash jd iqiyi
|
||||
#*/30 7-22 * * * bash jd bilibili
|
||||
#*/30 7-22 * * * bash jd unicom
|
||||
|
||||
# 此处为py脚本(包括喜马拉雅极速版)
|
||||
#*/30 * * * * bash jd xmly_speed py
|
||||
# 33 13 * * * js hangup
|
||||
|
||||
# 运行lxk0301大佬的js脚本,仅列出长期任务作初始化用,AutoAddCron=true时,将自动添加短期任务。
|
||||
# 请保留任务名称中的前缀"jd_",去掉后缀".js",如果有些任务你不想运行,注释掉就好了,不要删除。
|
||||
# 非lxk0301/jd_scripts仓库中的脚本不能以“jd_”、“jr_”、“jx_”开头。请在最后保留一个空行。
|
||||
5 9 * * * bash jd jd_bean_change
|
||||
28 5 * * * bash jd jd_bean_home
|
||||
4 0,9 * * * bash jd jd_bean_sign
|
||||
0,30 0 * * * bash jd jd_blueCoin
|
||||
12 8,12,18 * * * bash jd jd_bookshop
|
||||
37 7 * * * bash jd jd_car
|
||||
13 8,22 * * * bash jd jd_cash
|
||||
0 0 * * * bash jd jd_car_exchange
|
||||
2 0 * * * bash jd jd_club_lottery
|
||||
43 13 * * * bash jd jd_crazy_joy
|
||||
54 2-23/3 * * * bash jd jd_daily_egg
|
||||
20 * * * * bash jd jd_dreamFactory
|
||||
29 7,12,18 * * * bash jd jd_fruit
|
||||
49 6 * * * bash jd jd_get_share_code
|
||||
36 * * * * bash jd jd_jdfactory
|
||||
14 11 * * * bash jd jd_jdzz
|
||||
6 0,8,9,13,18,22 * * * bash jd jd_joy
|
||||
*/20 0-22 * * * bash jd jd_joy_feedPets
|
||||
0 0,8,12,16 * * * bash jd jd_joy_reward
|
||||
12 9-20/2 * * * bash jd jd_joy_run
|
||||
0 0,6 * * * bash jd jd_joy_steal
|
||||
0 9,12,18 * * * bash jd jd_jxnc
|
||||
32 7 * * * bash jd jd_kd
|
||||
13-33/5 13 * * * bash jd jd_live
|
||||
15 1 * * * bash jd jd_lotteryMachine
|
||||
40 */4 * * * bash jd jd_moneyTree
|
||||
20 0,20 * * * bash jd jd_necklace
|
||||
10 7,12,18 * * * bash jd jd_pet
|
||||
25 * * * * bash jd jd_pigPet
|
||||
35 7-22 * * * bash jd jd_plantBean
|
||||
11 0 * * * bash jd jd_rankingList
|
||||
1 1 * * * bash jd jd_redPacket
|
||||
0 0 * * * bash jd jd_shop
|
||||
16 0 * * * bash jd jd_small_home
|
||||
35 */3 * * * bash jd jd_speed
|
||||
9 1-23/5 * * * bash jd jd_superMarket
|
||||
25 9 * * * bash jd jd_syj
|
||||
44 5 * * 5 bash jd jd_unbind
|
||||
45 23 * * * bash jd jd_unsubscribe
|
||||
19 11 * * * bash jd jx_sign
|
||||
5 9 * * * js jd_bean_change
|
||||
28 5 * * * js jd_bean_home
|
||||
4 0,9 * * * js jd_bean_sign
|
||||
0,30 0 * * * js jd_blueCoin
|
||||
12 8,12,18 * * * js jd_bookshop
|
||||
37 7 * * * js jd_car
|
||||
13 8,22 * * * js jd_cash
|
||||
0 0 * * * js jd_car_exchange
|
||||
2 0 * * * js jd_club_lottery
|
||||
43 13 * * * js jd_crazy_joy
|
||||
54 2-23/3 * * * js jd_daily_egg
|
||||
20 * * * * js jd_dreamFactory
|
||||
29 7,12,18 * * * js jd_fruit
|
||||
49 6 * * * js jd_get_share_code
|
||||
36 * * * * js jd_jdfactory
|
||||
14 11 * * * js jd_jdzz
|
||||
6 0,8,9,13,18,22 * * * js jd_joy
|
||||
*/20 0-22 * * * js jd_joy_feedPets
|
||||
0 0,8,12,16 * * * js jd_joy_reward
|
||||
12 9-20/2 * * * js jd_joy_run
|
||||
0 0,6 * * * js jd_joy_steal
|
||||
0 9,12,18 * * * js jd_jxnc
|
||||
32 7 * * * js jd_kd
|
||||
13-33/5 13 * * * js jd_live
|
||||
15 1 * * * js jd_lotteryMachine
|
||||
40 */4 * * * js jd_moneyTree
|
||||
20 0,20 * * * js jd_necklace
|
||||
10 7,12,18 * * * js jd_pet
|
||||
25 * * * * js jd_pigPet
|
||||
35 7-22 * * * js jd_plantBean
|
||||
11 0 * * * js jd_rankingList
|
||||
1 1 * * * js jd_redPacket
|
||||
0 0 * * * js jd_shop
|
||||
16 0 * * * js jd_small_home
|
||||
35 */3 * * * js jd_speed
|
||||
9 1-23/5 * * * js jd_superMarket
|
||||
25 9 * * * js jd_syj
|
||||
44 5 * * 5 js jd_unbind
|
||||
45 23 * * * js jd_unsubscribe
|
||||
19 11 * * * js jx_sign
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 路径、环境判断
|
||||
ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
|
||||
ShellDir=${QL_DIR:-$(cd $(dirname $0); pwd)}
|
||||
LogDir=${ShellDir}/log
|
||||
ConfigDir=${ShellDir}/config
|
||||
FileConf=${ConfigDir}/config.sh
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#author:spark thanks to: https://github.com/sparkssssssss/scripts
|
||||
#需要docker环境,下载本文件到容器内任意位置,以下示例是放到了/jd/scripts
|
||||
#*/30 * * * * bash diy i-chenzhe qx
|
||||
|
||||
declare -A BlackListDict
|
||||
author=$1
|
||||
|
@ -18,7 +16,7 @@ if [ $# != 2 ] ; then
|
|||
exit 0;
|
||||
fi
|
||||
|
||||
diyscriptsdir=/jd/diyscripts
|
||||
diyscriptsdir=/ql/diyscripts
|
||||
mkdir -p ${diyscriptsdir}
|
||||
|
||||
if [ ! -d "$diyscriptsdir/${author}_${repo}" ]; then
|
||||
|
@ -52,29 +50,29 @@ function addnewcron {
|
|||
script_date=`cat $js|grep ^[0-9]|awk '{print $1,$2,$3,$4,$5}'|egrep -v "[a-zA-Z]|:|\."|sort |uniq|head -n 1`
|
||||
[ -z "${script_date}" ] && script_date=`cat $js|grep -Eo "([0-9]+|\*|[0-9]+[,-].*) ([0-9]+|\*|[0-9]+[,-].*) ([0-9]+|\*|[0-9]+[,-].*) ([0-9]+|\*|[0-9]+[,-].*) ([0-9]+|\*|[0-9][,-].*)"|sort |uniq|head -n 1`
|
||||
[ -z "${script_date}" ] && cron_min=$(rand 1 59) && cron_hour=$(rand 7 9) && script_date="${cron_min} ${cron_hour} * * *"
|
||||
[ $(grep -c -w "$croname" /jd/config/crontab.list) -eq 0 ] && sed -i "/hangup/a${script_date} bash jd $croname" /jd/config/crontab.list && addname="${addname}\n${croname}" && echo -e "添加了新的脚本${croname}." && bash jd ${croname} now >/dev/null &
|
||||
if [ ! -f "/jd/scripts/${author}_$js" ];then
|
||||
\cp $js /jd/scripts/${author}_$js
|
||||
[ $(grep -c -w "$croname" /ql/config/crontab.list) -eq 0 ] && sed -i "/hangup/a${script_date} js $croname" /ql/config/crontab.list && addname="${addname}\n${croname}" && echo -e "添加了新的脚本${croname}." && js ${croname} now >/dev/null &
|
||||
if [ ! -f "/ql/scripts/${author}_$js" ];then
|
||||
\cp $js /ql/scripts/${author}_$js
|
||||
else
|
||||
change=$(diff $js /jd/scripts/${author}_$js)
|
||||
[ -n "${change}" ] && \cp $js /jd/scripts/${author}_$js && echo -e "${author}_$js 脚本更新了."
|
||||
change=$(diff $js /ql/scripts/${author}_$js)
|
||||
[ -n "${change}" ] && \cp $js /ql/scripts/${author}_$js && echo -e "${author}_$js 脚本更新了."
|
||||
fi
|
||||
done
|
||||
[ "$addname" != "" ] && bash notify "新增 ${author} 自定义脚本" "${addname}"
|
||||
[ "$addname" != "" ] && notify "新增 ${author} 自定义脚本" "${addname}"
|
||||
|
||||
}
|
||||
|
||||
function delcron {
|
||||
delname=""
|
||||
cronfiles=$(grep "$author" /jd/config/crontab.list|grep -v "^#"|awk '{print $8}'|awk -F"${author}_" '{print $2}')
|
||||
cronfiles=$(grep "$author" /ql/config/crontab.list|grep -v "^#"|awk '{print $8}'|awk -F"${author}_" '{print $2}')
|
||||
for filename in $cronfiles;
|
||||
do
|
||||
if [ ! -f "${diyscriptsdir}/${author}_${repo}/${filename}.js" ]; then
|
||||
sed -i "/\<bash jd ${author}_${filename}\>/d" /jd/config/crontab.list && echo -e "删除失效脚本${filename}."
|
||||
sed -i "/\<js ${author}_${filename}\>/d" /ql/config/crontab.list && echo -e "删除失效脚本${filename}."
|
||||
delname="${delname}\n${author}_${filename}"
|
||||
fi
|
||||
done
|
||||
[ "$delname" != "" ] && bash notify "删除 ${author} 失效脚本" "${delname}"
|
||||
[ "$delname" != "" ] && notify "删除 ${author} 失效脚本" "${delname}"
|
||||
}
|
||||
|
||||
if [[ ${gitpullstatus} -eq 0 ]]
|
||||
|
@ -83,7 +81,7 @@ then
|
|||
delcron
|
||||
else
|
||||
echo -e "$author 仓库更新失败了."
|
||||
bash notify "自定义仓库更新失败" "$author"
|
||||
notify "自定义仓库更新失败" "$author"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 文件路径、脚本网址、文件版本以及各种环境的判断
|
||||
ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
|
||||
[[ ${JD_DIR} ]] && ShellJd=jd || ShellJd=${ShellDir}/shell/jd.sh
|
||||
ShellDir=${QL_DIR:-$(cd $(dirname $0); pwd)}
|
||||
[[ ${QL_DIR} ]] && ShellJs=js
|
||||
LogDir=${ShellDir}/log
|
||||
[ ! -d ${LogDir} ] && mkdir -p ${LogDir}
|
||||
ScriptsDir=${ShellDir}/scripts
|
||||
|
@ -49,7 +49,7 @@ function Update_Cron {
|
|||
for ((i=1; i<${#RanHourArray[*]}; i++)); do
|
||||
RanHour="${RanHour},${RanHourArray[i]}"
|
||||
done
|
||||
perl -i -pe "s|.+(bash.+git_pull.+log.*)|${RanMin} ${RanHour} \* \* \* sleep ${RanSleep} && \1|" ${ListCron}
|
||||
perl -i -pe "s|.+(git_pull.+log.*)|${RanMin} ${RanHour} \* \* \* sleep ${RanSleep} && \1|" ${ListCron}
|
||||
crontab ${ListCron}
|
||||
fi
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ function Git_PullScripts {
|
|||
|
||||
## 更新docker-entrypoint
|
||||
function Update_Entrypoint {
|
||||
if [[ ${JD_DIR} ]] && [[ $(cat ${ShellDir}/docker/docker-entrypoint.sh) != $(cat /usr/local/bin/docker-entrypoint.sh) ]]; then
|
||||
if [[ ${QL_DIR} ]] && [[ $(cat ${ShellDir}/docker/docker-entrypoint.sh) != $(cat /usr/local/bin/docker-entrypoint.sh) ]]; then
|
||||
cp -f ${ShellDir}/docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
chmod 777 /usr/local/bin/docker-entrypoint.sh
|
||||
fi
|
||||
|
@ -118,7 +118,7 @@ function Update_Entrypoint {
|
|||
## js-drop.list 如果上述检测文件删除了定时任务,这个文件内容将不为空
|
||||
function Diff_Cron {
|
||||
if [ -f ${ListCron} ]; then
|
||||
if [ -n "${JD_DIR}" ]
|
||||
if [ -n "${QL_DIR}" ]
|
||||
then
|
||||
grep -E " j[drx]_\w+" ${ListCron} | perl -pe "s|.+ (j[drx]_\w+).*|\1|" | sort -u > ${ListTask}
|
||||
else
|
||||
|
@ -149,7 +149,7 @@ function Notify_Version {
|
|||
if [ -f ${FileConf} ] && [[ "${VerConf}" != "${VerConfSample}" ]] && [[ ${UpdateDate} == $(date "+%Y-%m-%d") ]]
|
||||
then
|
||||
if [ ! -f ${SendCount} ]; then
|
||||
bash notify "检测到配置文件config.sh.sample有更新" "更新日期: ${UpdateDate}\n当前版本: ${VerConf}\n新的版本: ${VerConfSample}\n更新内容: ${UpdateContent}\n更新说明: 如需使用新功能请对照config.sh.sample,将相关新参数手动增加到你自己的config.sh中,否则请无视本消息。本消息只在该新版本配置文件更新当天发送一次。"
|
||||
notify "检测到配置文件config.sh.sample有更新" "更新日期: ${UpdateDate}\n当前版本: ${VerConf}\n新的版本: ${VerConfSample}\n更新内容: ${UpdateContent}\n更新说明: 如需使用新功能请对照config.sh.sample,将相关新参数手动增加到你自己的config.sh中,否则请无视本消息。本消息只在该新版本配置文件更新当天发送一次。"
|
||||
fi
|
||||
else
|
||||
[ -f ${ContentVersion} ] && rm -f ${ContentVersion}
|
||||
|
@ -234,7 +234,7 @@ function Del_Cron {
|
|||
crontab -l
|
||||
echo -e "\n--------------------------------------------------------------\n"
|
||||
if [ -d ${ScriptsDir}/node_modules ]; then
|
||||
bash notify "删除 lxk0301 失效脚本" "${JsDrop}"
|
||||
notify "删除 lxk0301 失效脚本" "${JsDrop}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -254,9 +254,9 @@ function Add_Cron {
|
|||
do
|
||||
if [[ ${Cron} == jd_bean_sign ]]
|
||||
then
|
||||
echo "4 0,9 * * * bash ${ShellJd} ${Cron}" >> ${ListCron}
|
||||
echo "4 0,9 * * * ${ShellJs} ${Cron}" >> ${ListCron}
|
||||
else
|
||||
cat ${ListCronLxk} | grep -E "\/${Cron}\." | perl -pe "s|(^.+)node */scripts/(j[drx]_\w+)\.js.+|\1bash ${ShellJd} \2|" >> ${ListCron}
|
||||
cat ${ListCronLxk} | grep -E "\/${Cron}\." | perl -pe "s|(^.+)node */scripts/(j[drx]_\w+)\.js.+|\${ShellJs} \2|" >> ${ListCron}
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -267,12 +267,12 @@ function Add_Cron {
|
|||
crontab -l
|
||||
echo -e "\n--------------------------------------------------------------\n"
|
||||
if [ -d ${ScriptsDir}/node_modules ]; then
|
||||
bash notify "新增 lxk0301 自定义脚本" "${JsAdd}"
|
||||
notify "新增 lxk0301 自定义脚本" "${JsAdd}"
|
||||
fi
|
||||
else
|
||||
echo -e "添加新的定时任务出错,请手动添加...\n"
|
||||
if [ -d ${ScriptsDir}/node_modules ]; then
|
||||
bash notify "尝试自动添加 lxk0301 以下新的定时任务出错,请手动添加:" "${JsAdd}"
|
||||
notify "尝试自动添加 lxk0301 以下新的定时任务出错,请手动添加:" "${JsAdd}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 路径
|
||||
ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
|
||||
[[ ${JD_DIR} ]] && HelpJd=jd || HelpJd=jd.sh
|
||||
[[ ${JD_DIR} ]] && ShellJd=jd || ShellJd=${ShellDir}/shell/jd.sh
|
||||
ShellDir=${QL_DIR:-$(cd $(dirname $0); pwd)}
|
||||
[[ ${QL_DIR} ]] && ShellJS=js
|
||||
ScriptsDir=${ShellDir}/scripts
|
||||
ConfigDir=${ShellDir}/config
|
||||
FileConf=${ConfigDir}/config.sh
|
||||
|
@ -142,11 +141,11 @@ function Random_Delay {
|
|||
## 使用说明
|
||||
function Help {
|
||||
echo -e "本脚本的用法为:"
|
||||
echo -e "1. bash ${HelpJd} xxx # 如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数"
|
||||
echo -e "2. bash ${HelpJd} xxx now # 无论是否设置了随机延迟,均立即运行"
|
||||
echo -e "3. bash ${HelpJd} runall # 运行所有非挂机脚本,非常耗时"
|
||||
echo -e "4. bash ${HelpJd} hangup # 重启挂机程序"
|
||||
echo -e "5. bash ${HelpJd} resetpwd # 重置控制面板用户名和密码"
|
||||
echo -e "1. ${ShellJS} xxx # 如果设置了随机延迟并且当时时间不在0-2、30-31、59分内,将随机延迟一定秒数"
|
||||
echo -e "2. ${ShellJS} xxx now # 无论是否设置了随机延迟,均立即运行"
|
||||
echo -e "3. ${ShellJS} runall # 运行所有非挂机脚本,非常耗时"
|
||||
echo -e "4. ${ShellJS} hangup # 重启挂机程序"
|
||||
echo -e "5. ${ShellJS} resetpwd # 重置控制面板用户名和密码"
|
||||
echo -e "\n针对用法1、用法2中的\"xxx\",可以不输入后缀\".js\",另外,如果前缀是\"jd_\"的话前缀也可以省略。"
|
||||
echo -e "当前有以下脚本可以运行(仅列出以jd_、jr_、jx_开头的脚本):"
|
||||
cd ${ScriptsDir}
|
||||
|
@ -203,7 +202,7 @@ function Run_All {
|
|||
done
|
||||
for file in $(cat ${ListJs}); do
|
||||
echo -e "==================== 运行 $file.js 脚本 ====================\n"
|
||||
bash ${ShellJd} $file now
|
||||
${ShellJS} $file now
|
||||
done
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const notify = require('/jd/scripts/sendNotify');
|
||||
const notify = require('/ql/scripts/sendNotify');
|
||||
const title = process.argv[2];
|
||||
const content = process.argv[3];
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
#author:spark thanks to: https://github.com/sparkssssssss/scripts
|
||||
|
||||
. /jd/config/cookie.sh
|
||||
. /jd/config/config.sh
|
||||
. /ql/config/cookie.sh
|
||||
. /ql/config/config.sh
|
||||
title=$(echo $1|sed 's/-/_/g')
|
||||
msg=$(echo -e $2)
|
||||
|
||||
node /jd/shell/notify.js "$title" "$msg"
|
||||
node /ql/shell/notify.js "$title" "$msg"
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
|
||||
ShellDir=${QL_DIR:-$(cd $(dirname $0); pwd)}
|
||||
|
||||
echo -e "更新shell...\n"
|
||||
cd ${ShellDir}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## 判断环境
|
||||
ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
|
||||
ShellDir=${QL_DIR:-$(cd $(dirname $0); pwd)}
|
||||
LogDir=${ShellDir}/log
|
||||
|
||||
## 导入配置文件
|
||||
|
|
Loading…
Reference in New Issue
Block a user