gigasavvy/uptyme

基于CLI的脚本来验证网站是否在线。

v0.1.3 2017-06-19 02:18 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:48:17 UTC


README

Uptyme 是一个PHP CLI脚本,用于验证网站的在线时间。

为什么写成 Uptyme,你是代码潮人吗?

uptime 是一个用于检查系统在线时间的Linux命令。显然,我们不能使用这个名字!

安装

composer global require gigasavvy/uptyme

用法

Uptyme 应该通过命令行运行,并且可以用多种方式使用。

基本检查

要检查单个网站是否在线,请使用以下命令

$ uptyme run https://gigasavvy.com
Checking HTTPS integrity of the given domains...
Checker completed with 0 failed domains.

要检查多个网站是否在线,只需将额外的域名作为参数传递

$ uptyme run https://gigasavvy.com https://google.com https://php.ac.cn
Checking HTTPS integrity of the given domains...
Checker completed with 0 failed domains.

日志记录

要启用日志(对于基于cron的运行很有用),请将日志文件传递给 --log 选项

$ uptyme run https://gigasavvy.com --log /var/log/uptyme.log
Checking HTTPS integrity of the given domains...
Checker completed with 0 failed domains.
Check logs for more info (/var/log/uptyme.log)

Slack 集成

对于任何失败的网站,您可以通过传递您的 Slack webhook url 到 --slack 选项来通过 Slack 获得警报

$ uptyme run https://foo.bar --slack https://hooks.slack.com/services/123/456
Checking HTTPS integrity of the given domains...
Checker completed with 1 failed domains.
Failed domains:
https://foo.bar

正如我们所看到的,网站 https://foo.bar 连接失败。通过传递 --slack 选项,您的 Slack 频道也会收到通知。