GithubHelp home page GithubHelp logo

blueskyxn / lovespeed Goto Github PK

View Code? Open in Web Editor NEW
38.0 1.0 11.0 39 KB

Shell脚本:定时自动测速speedtest并推送结果至tg(Telegram) 燃烧流量&锻炼小鸡

Home Page: https://www.blueskyxn.com

License: Apache License 2.0

Shell 100.00%

lovespeed's Introduction

lovespeed

Shell脚本:定时自动测速speedtest并推送结果至tg(Telegram) 燃烧流量&锻炼小鸡

简介

支持:

定时任务√ 循环运行√ 自定义测速点√ 私聊推送√ 频道推送√ 群组推送√ 多测速点√ 计算单次消耗√ 推送内容自定义√

目标:

无需手动测速

帮你开心消耗流量

手都不用动

直接围观速度变化

自定义参数

测速命令:/root/speedtest -s 8888 指定测速点,也可以不加,则默认。测速点id可以从某些脚本开头获取,或者去web版查

ls1/ls2 : 从测速报告提取数据行,并移除开头空空格,可以根据格式修改

lsn:自定义文字,我用来做机器名,你也可以根据格式自定义

cid:tg识别id,用户为纯数字,群组频道为-100开头数字或者@xxx 其他写法不一定可用,id可从nekogramx看到,或者用@mychatinfobot。用户需要先对话,群组频道可能需要管理员

api:从@botfather获取的bot API

Text:后面为发送的字符,变量要加符号,直接换行空格都行,apitext相关语法 https://www.coder.work/article/1757059

进阶玩法

定时任务

方法很多,推荐宝塔面板自带定时任务,直接用./或者脚本路径或者bash xxx.sh等方法,根据提示设置即可

不过,我自己实验宝塔会出错,请在/var/spool/cron/root中 根据格式编辑 [分 时 日 月 星期]

比如: 00 21 * * * bash /root/lovespeed.sh > /dev/null 2>&1

如果没有正常运行,需要额外添加环境变量,如

00 21 * * * source /etc/profile;/bin/bash bash /root/lovespeed.sh > /dev/null 2>&1

循环测速

最简单就是多来点定时任务,或者你直接把脚本copy进去放一块

自定义测速点

根据变量说明修改测速点,大部分测速脚本都有标id,或者自己去web找

私聊/频道/群组推送

参考变量说明,获取id上权限,id获取方法自行搜索,我用nekox

多测速点

参考脚本写法,copy一下,改个名字,复读就完事

计算单次消耗

speedtest友好的帮你把消耗量计算好了

推送内容自定义

参考脚本语法,改起来很简单,框架原理就这样

安装问题

直接把speedtest程序和脚本下载到机器上,修改后,运行就行

Speedtest文件问题

用我的工具箱下载Speedtest

wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh

首先使用Speedtest需要先授权,运行后输入YES

/root/speedtest

扩展用法

参考语法,可以把各种脚本都做成这样,跑完发送结果到tg

lovespeed's People

Contributors

blueskyxn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.