loong

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Loong (东方青龙, 守护 Web Service)

功能

  • 周期检查指定网址的响应码和包含的文本
  • 异常时自动执行重启服务命令

使用

loong.exe -h

./loong -h

NAME:
   Daemon Web Server - 守护 Windows / Linux 的网站服务

USAGE:
   - 请使用管理员身份运行
   - 用于老旧边缘服务, 临时守护
   - 支持 Windows / Linux, 可指定重启命令

VERSION:
   v0.0.2.21092818

AUTHOR:
   Fufu <fufuok.com>

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug, -d                    调试模式 (default: false)
   --log value, -l value          文件日志级别: debug, info, warn, error, fatal, panic (default: "info")
   --logfile value                日志文件位置 (default: "log/loong.log")
   --errorlogfile value           错误级别的日志文件位置 (default: "log/loong.error.log")
   --url value, -u value          检查的网址
   --status-code value, -s value  网址需要返回的状态码 (default: 200)
   --text value, -t value         指定网页要包含的文本
   --web-service value, -w value  Web 服务类型 (IIS / Apache) (default: "iis")
   --interval value, -i value     检查时间间隔 (秒) (default: 180)
   --cmd value, -c value          指定重启命令 (优先使用)
   --help, -h                     show help (default: false)
   --version, -v                  print the version (default: false)

COPYRIGHT:
   https://github.com/fufuok/loong

示例

loong.exe -d -u http://111.222 -w test -i 5

loong.exe -d -u https://www.baidu.com -i 30

./loong -u http://127.0.0.1:8080/ping -t PONG -i 5

ff

Documentation

Index

Constants

View Source
const (
	// APPName 应用名称, 用于日志文件名
	APPName = "loong"
)

Variables

View Source
var (
	// RootPath 运行绝对路径
	RootPath = utils.ExecutableDir(true)

	// LogDir 日志路径
	LogDir        = filepath.Join(RootPath, "log")
	LogFile       = filepath.Join(LogDir, APPName+".log")
	ErrorLogFile  = filepath.Join(LogDir, APPName+".error.log")
	DaemonLogFile = filepath.Join(LogDir, APPName+".daemon.log")
)

Functions

func Daemon

func Daemon()

Daemon 守护 Web 服务

func InitMain added in v0.0.2

func InitMain(c *TConfig)

Types

type TConfig

type TConfig struct {
	Debug        bool
	LogLevel     string
	LogFile      string
	ErrorLogFile string
	URL          string
	StatusCode   int
	ContainsText string
	WebService   string
	Interval     time.Duration
	ResetCmd     map[string]string
}

Directories

Path Synopsis
cli
loong command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址