mirror of https://github.com/MedzikUser/go-pingbot
update
This commit is contained in:
parent
330998710b
commit
a350ed7dee
30
README.md
30
README.md
|
@ -9,7 +9,29 @@ This application "pings" websites every few minutes (to be set in config). It ca
|
|||
|
||||
* 💻 Linux amd64
|
||||
* [Download](https://github.com/MedzikUser/go-pingbot/releases) latest version
|
||||
* Unpack file `tar xzf pingbot_{VERSION}_linux_amd64.tar.gz`
|
||||
* Create an .env and config.toml file and complete according to .env.schema and config.schema.toml
|
||||
* Add permissions `chmod +rwx pingbot.out`
|
||||
* Run binary `./pingbot.out`
|
||||
* Unpack file `tar xzf pingbot_*_linux_amd64.tar.gz`
|
||||
* Done your binary is `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`
|
||||
|
|
3
main.go
3
main.go
|
@ -42,14 +42,15 @@ func main() {
|
|||
client := updater.Client{
|
||||
GitHub: config.GH_Repo,
|
||||
GitHubToken: config.GH_Token,
|
||||
CheckEvery: config.Toml.AutoUpdate.Check * time.Minute,
|
||||
Version: config.Version,
|
||||
Binary: "pingbot.out",
|
||||
CheckEvery: config.Toml.AutoUpdate.Check * time.Minute,
|
||||
AfterUpdate: func() {
|
||||
log.Info("Updated!")
|
||||
|
||||
os.Exit(1)
|
||||
},
|
||||
Major: false,
|
||||
}
|
||||
|
||||
go client.AutoUpdater()
|
||||
|
|
10
nodemon.sh
10
nodemon.sh
|
@ -1,17 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Colors
|
||||
red="\e[0;91m"
|
||||
reset="\e[0m"
|
||||
RED="\e[0;91m"
|
||||
NC="\e[0m" # No Color
|
||||
|
||||
if ! go build -o pingbot.out; then
|
||||
echo -e "${reset}[${red}COMPILE ERROR${reset}]"
|
||||
echo -e "${reset}[${RED}COMPILE ERROR${NC}]"
|
||||
exit 1
|
||||
else
|
||||
if ! ./pingbot.out; then
|
||||
echo -e "${reset}[${red}PROGRAM PANIC${reset}]"
|
||||
echo -e "${reset}[${RED}PROGRAM PANIC${NC}]"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${reset}[${red}PROGRAM END${reset}]"
|
||||
echo -e "${reset}[${RED}PROGRAM END${NC}]"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue