GithubHelp home page GithubHelp logo

hitsz-dailyreport's Introduction

HITSZ-DailyReport

本脚本仅用作学习交流。

一个实现定时上报疫情信息的bash脚本。

初始配置

  1. DailyReport.shconfigure放在同一目录下;

  2. DailyReport.sh执行权限:chmod +x DailyReport.sh

  3. 按样例认真填写填写configure文件;

  4. 运行./DailyReport.sh,若输出类似

    [2022/03/13-20:40:04]:{"isSuccess":true,"module":"1","msg":""}

    的信息则证明脚本成功运行。

脚本运行

推荐使用ubuntu-server已经内置的crontab进行脚本的定时运行。

第一次运行crontab时,在命令行输入crontab -e编辑crontab的配置文件来添加作业。

输入命令后可以选择一种编辑方式,在末尾写入

0 */6 * * * cd /your/path/to/DailyReport && ./DailyReport.sh >> ./log 2>&1

(cd的目录是DailyReport.shconfigure文件所在的目录)

保存退出后重启crontab:

service cron restart

即可实现每六小时填报一次,并将结果写入到log文件中(和上面两个文件在同一目录)。

修改未在配置文件中的上报信息

配置文件中可修改的条目并不是上报信息的全部,用户也可以自己定义其他未出现的上报条目

首先打开疫情上报的页面,填好所需上报的内容。

随后按F12打开开发者工具,然后再点击提交。在开发工具的网络项中找到save项,并复制为cURL(bash):

复制下来的内容中的--data-raw一项即为提交的内容。

只需将其中token对应的内容(最后两个%22中间的部分)替换为$token,然后整体填入DailReport.sh第172行的双引号之间即可。

hitsz-dailyreport's People

Contributors

ch3chohch3 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.