#!/bin/bash
LOGFILE="/var/log/zabbix/zabbix_sms.log"
DATE_N="$(date +‘%Y%m%d%H%M%S‘)"
USER_N=whoami
#:>"$LOGFILE"
#exec 1>>"$LOGFILE"
#exec 2>&1
MSG_URL_SH=http://172.16.8.168:8080/test-sms/sendSms.htm
MOBILE_NUMBER=$1
MESSAGE_UTF8=$3
XXD="/usr/bin/xxd"
MESSAGE_ENCODE=$(echo "$MESSAGE_UTF8" | ${XXD} -ps | sed ‘s/(..)/%\1/g‘ | tr -d ‘\n‘)
CURL=/usr/bin/curl -X POST --connect-timeout 5 -d "mobile=${MOBILE_NUMBER}&content=${MESSAGE_ENCODE}&subType=5001" ${MSG_URL_SH}
echo "${DATE_N} ${USER_N} execute $0 [INFO] ${CURL} [email protected]" >>$LOGFILE
原文地址:http://blog.51cto.com/10880347/2153134
时间: 2024-10-08 19:57:03