Init Go project base

Signed-off-by: adrien <adrien@iglou.eu>
This commit is contained in:
adrien 2019-09-20 11:39:02 +02:00
parent 31c79becf2
commit 2d5d3552de
9 changed files with 18 additions and 74 deletions

17
.gitignore vendored
View File

@ -1,3 +1,20 @@
status.html
*.back
*.backup
docs/public*
/.idea
*.test
*.prof
nohup.out
cover.out
*.swp
*.swo
*~
vendor/*/
*.bench
*.debug
coverage*.out
GoBuilds
dist
vendor

View File

@ -22,4 +22,4 @@ Each line is a tested url, composed like `STATUS:URL[:PORT]`:
Except all lines prefixed by `#` **OR **`%`
- `#` is for comments
- `%` is for commands when a check fail
- `%` is for commands when a check fail

View File

@ -1,4 +0,0 @@
#%COMMANDE
%echo -e \"ma commande et les erreur:\\n~outS~\"
#HTTP_status_codes:URL[:PORT]
200:https://iglou.eu

View File

@ -1,69 +0,0 @@
#!/bin/bash
trap "exit 0" 2 3
time=60
cerebro () {
cmdR=()
local _buff=""
while read line ; do
[ -z "$line" ] && continue
[ "${line:0:1}" == "#" ] && continue
[ "${line:0:1}" == "%" ] && cmdR+=("${line:1}") && continue
url=${line#*:}
status=${line%%:*}
rq=$(curl -I -s "$url" -o /dev/null -w "%{http_code}\n")
[ $rq -eq $status ] || _buff="${_buff}${rq} ${url#*//}\n"
done < "${urls}"
if [ -z "$_buff" ]; then
outC="OK!\n$(date +"%d/%m/%Y %T")"
elif [ "$_buff" != "$outC" ]; then
outC="$_buff"
xPsy
fi
echo -e "$outC"
echo -e "$outC" > "$html"
}
xPsy () {
local _buff=""
for ((i = 0; i < ${#cmdR[@]}; i++))
do
_buff="${cmdR[$1]}"
_buff="${_buff/~outC~/$outC}"
_buff="$(eval "$_buff" 2>&1)"
echo "$_buff"
done
}
root="$(cd "$(dirname "$0")"; pwd)"
html="${1:-${root}/status.html}"
urls="${2:-${root}/url.list}"
outC=""
cmdR=()
if [ "$1" == "-h" ]; then
echo -e "usage : $(basename "$0") [<html output path> [<url list path>]]\n"
exit 0
fi
if [ ! -w "${html%/*}" ]; then
echo "Unable to write ${html}"
exit 1
fi
if [ ! -r "${urls}" ]; then
echo "Unable to read ${urls}"
exit 1
fi
while true; do
cerebro
sleep $time
done

0
cmd/xavier-srv/.keep Normal file
View File

View File

0
examples/.keep Normal file
View File

0
scripts/.keep Normal file
View File

0
test/.keep Normal file
View File