24 lines
440 B
Text
24 lines
440 B
Text
#!/bin/bash
|
|
|
|
# Send an Alert via IM system
|
|
|
|
rawurlencode() {
|
|
local string="${@}"
|
|
local strlen=${#string}
|
|
local encoded=""
|
|
local pos c o
|
|
|
|
for (( pos=0 ; pos<strlen ; pos++ )); do
|
|
c=${string:$pos:1}
|
|
case "$c" in
|
|
[-_.~a-zA-Z0-9] ) o="${c}" ;;
|
|
* ) printf -v o '%%%02x' "'$c"
|
|
esac
|
|
encoded+="${o}"
|
|
done
|
|
_ALERT="${encoded}"
|
|
}
|
|
|
|
rawurlencode $@
|
|
|
|
curl -s "<%= @bot_alert_url %>$_ALERT"
|