This commit is contained in:
Medzik 2021-08-22 12:04:12 +02:00
parent 330998710b
commit a350ed7dee
3 changed files with 33 additions and 10 deletions

View File

@ -9,7 +9,29 @@ This application "pings" websites every few minutes (to be set in config). It ca
* 💻 Linux amd64 * 💻 Linux amd64
* [Download](https://github.com/MedzikUser/go-pingbot/releases) latest version * [Download](https://github.com/MedzikUser/go-pingbot/releases) latest version
* Unpack file `tar xzf pingbot_{VERSION}_linux_amd64.tar.gz` * Unpack file `tar xzf pingbot_*_linux_amd64.tar.gz`
* Create an .env and config.toml file and complete according to .env.schema and config.schema.toml * Done your binary is `pingbot.out`
* Add permissions `chmod +rwx pingbot.out`
* Run binary `./pingbot.out` ## Compile from Source Code
Not recommended because automatic updates don't work
### Requirements
* [Go](https://golang.org/dl) (recommended latest version)
### Compile
* Download source code `git clone https://github.com/MedzikUser/go-pingbot.git --depth 1`
* Go to folder with source code `cd go-pingbot`
* Download dependencies `go mod tidy`
* Build `go build -o pingbot.out`
* Done your compined binary is `pingbot.out`
## Configurate
* Complete .env according to .env.schema
* And fill in config.toml according to config.schema.toml
## Run
* `./pingbot.out`

View File

@ -42,14 +42,15 @@ func main() {
client := updater.Client{ client := updater.Client{
GitHub: config.GH_Repo, GitHub: config.GH_Repo,
GitHubToken: config.GH_Token, GitHubToken: config.GH_Token,
CheckEvery: config.Toml.AutoUpdate.Check * time.Minute,
Version: config.Version, Version: config.Version,
Binary: "pingbot.out", Binary: "pingbot.out",
CheckEvery: config.Toml.AutoUpdate.Check * time.Minute,
AfterUpdate: func() { AfterUpdate: func() {
log.Info("Updated!") log.Info("Updated!")
os.Exit(1) os.Exit(1)
}, },
Major: false,
} }
go client.AutoUpdater() go client.AutoUpdater()

View File

@ -1,17 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Colors # Colors
red="\e[0;91m" RED="\e[0;91m"
reset="\e[0m" NC="\e[0m" # No Color
if ! go build -o pingbot.out; then if ! go build -o pingbot.out; then
echo -e "${reset}[${red}COMPILE ERROR${reset}]" echo -e "${reset}[${RED}COMPILE ERROR${NC}]"
exit 1 exit 1
else else
if ! ./pingbot.out; then if ! ./pingbot.out; then
echo -e "${reset}[${red}PROGRAM PANIC${reset}]" echo -e "${reset}[${RED}PROGRAM PANIC${NC}]"
exit 1 exit 1
else else
echo -e "${reset}[${red}PROGRAM END${reset}]" echo -e "${reset}[${RED}PROGRAM END${NC}]"
fi fi
fi fi