adding ntfy

This commit is contained in:
colin 2024-02-22 16:32:33 +00:00
parent 4cc9f633b5
commit 73ebf15822
1 changed files with 5 additions and 1 deletions

View File

@ -37,18 +37,22 @@ function run_apache_bench_and_check_ttfb {
done done
} }
function upload_to_hastebin { function upload_to_hastebin_and_notify {
local log_file="/logs/authenticated.csv" local log_file="/logs/authenticated.csv"
local response=$(curl -X POST -s --data-binary @"${log_file}" https://haste.nixc.us/documents) local response=$(curl -X POST -s --data-binary @"${log_file}" https://haste.nixc.us/documents)
local key=$(echo $response | awk -F '"' '{print $4}') local key=$(echo $response | awk -F '"' '{print $4}')
if [ ! -z "$key" ]; then if [ ! -z "$key" ]; then
local haste_url="https://haste.nixc.us/$key" local haste_url="https://haste.nixc.us/$key"
echo "Logs uploaded to: $haste_url" echo "Logs uploaded to: $haste_url"
# Send notification with the Haste URL, including the authentication token
curl -X POST -H "Authorization: Bearer tk_xjkgklandq47adj1f17bw6edtilh4" -d "$haste_url" https://ntfy.nixc.us/bnHobG80sO5ZF4SB
else else
echo "Failed to upload logs to Hastebin." echo "Failed to upload logs to Hastebin."
fi fi
} }
prepare_log_file prepare_log_file
run_apache_bench_and_check_ttfb run_apache_bench_and_check_ttfb
upload_to_hastebin upload_to_hastebin