Commit 8dbd07bb authored by Dominika Liberda's avatar Dominika Liberda 💽
Browse files

* fixes for running on FreeBSD w/ small process quota

parent e3d1559c
......@@ -8,12 +8,12 @@ for i in $json; do
label="$(awk -F'{print $1}' <<< "$i")"
label_sha="$(shasum <<< "$label" | cut -c 1-16)"
addr="$(awk -F'{print $2}' <<< "$i")"
res="$(ping -c 1 -W 1.5 $addr > >(grep icmp_seq | sed -E 's/.*icmp_seq=1//'))"
res="$(ping -c 1 $addr > >(grep icmp_seq | sed -E 's/.*icmp_seq=.//'))"
status=$?
if [[ "$status" == 0 ]]; then
if [[ "$res" == *"time"* ]]; then
res_parsed="$(grep -Poh "time=.*?ms" <<< "$res" | sed -E 's/time=//g;s/ms//g' | tr -d ' ')"
res_parsed="$(grep -Eoh "time=.*ms" <<< "$res" | sed -E 's/time=//g;s/ms//g' | tr -d ' ')"
else
res_parsed='#'
fi
......
......@@ -16,13 +16,13 @@ for i in $json; do
[[ "$method" == '' ]] && method="GET"
if [[ "$match" == "body" ]]; then
res="$(curl -A "${cfg[useragent]}" -s -X "$method" "$url" --data "$data" | grep -P "$string")"
res="$(curl -A "${cfg[useragent]}" -s -X "$method" "$url" --data "$data" | grep -E "$string")"
status=$?
elif [[ "$match" == "head" ]]; then
res="$(curl -A "${cfg[useragent]}" -sD - -o /dev/null -X "$method" "$url" --data "$data" | grep -P "$string")"
res="$(curl -A "${cfg[useragent]}" -sD - -o /dev/null -X "$method" "$url" --data "$data" | grep -E "$string")"
status=$?
elif [[ "$match" == "status" ]]; then
res="$(curl -A "${cfg[useragent]}" -sD - -o /dev/null -X "$method" "$url" --data "$data" | grep -P "HTTP.*? $string")"
res="$(curl -A "${cfg[useragent]}" -sD - -o /dev/null -X "$method" "$url" --data "$data" | grep -E "HTTP.*? $string")"
status=$?
fi
......
......@@ -2,9 +2,5 @@
## your application-specific config goes here!
cfg[useragent]="dtr/1.0 (https://git.sakamoto.pl/domi/dtr)"
cfg[telegram_bot_token]=""
worker_add every_1min 60
worker_add every_5min 300
worker_add every_30min 1800
worker_add notify 60
worker_add checker 60
#!/bin/bash
if [[ "$counter5" == '' ]]; then
counter5=5
else
counter5=$((counter5+1))
fi
if [[ "$counter30" == '' ]]; then
counter30=30
else
counter30=$((counter30+1))
fi
source "${cfg[namespace]}/code/ping.sh" every_1min
source "${cfg[namespace]}/code/req.sh" every_1min
if [[ $counter30 == 30 ]]; then
source "${cfg[namespace]}/code/ping.sh" every_30min
source "${cfg[namespace]}/code/req.sh" every_30min
counter30=0
fi
if [[ $counter5 == 5 ]]; then
source "${cfg[namespace]}/code/ping.sh" every_5min
source "${cfg[namespace]}/code/req.sh" every_5min
counter5=0
fi
source "${cfg[namespace]}/code/notify.sh"
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_1min
source "${cfg[namespace]}/code/req.sh" every_1min
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_30min
source "${cfg[namespace]}/code/req.sh" every_30min
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_5min
source "${cfg[namespace]}/code/req.sh" every_5min
#!/bin/bash
source "${cfg[namespace]}/code/notify.sh"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment