From 66b4364643a1228179e0b027556568e70678b943 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 22 Sep 2010 18:02:54 +0200 Subject: Add getfilevar() function and use it for credentials at providers. --- localkannel-dispatch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'localkannel-dispatch') diff --git a/localkannel-dispatch b/localkannel-dispatch index 2310d7d..ee9cd36 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -30,6 +30,13 @@ uriunescape() { fi } +# Resolve var from "variable = value" pair in file below /etc/local +getfilevar() { + file="/etc/local/$1" + var="$2" + grep -m1 "^$var" "$file" | awk -F '(= )' '{print $2}' +} + lastservicephone() { logfile=/var/log/kannel/smsbox.log tac $logfile $logfile.1 \ @@ -105,8 +112,8 @@ case "$provider" in coolsms) unset SMS_SMSC SMS_URL="https://sms.coolsmsc.dk:8081/" - SMS_USER="drjones1" - SMS_PW="rahYSeGY" + SMS_USER=$(getfilevar coolsms user) + SMS_PW=$(getfilevar coolsms pw) SMS_CP="cp1252" SMS_MSGTAG="message" export SMS_URL SMS_USER SMS_PW SMS_CP SMS_MSGTAG @@ -116,11 +123,11 @@ case "$provider" in clickatell) unset SMS_SMSC SMS_URL="https://api.clickatell.com/http/sendmsg" - SMS_USER="jonas" - SMS_PW="inaritab6" + SMS_USER=$(getfilevar clickatell user) + SMS_PW=$(getfilevar clickatell pw) SMS_CP="iso8859-1" SMS_USERTAG="user" - SMS_API="3231280" + SMS_API=$(getfilevar clickatell api) SMS_CALLBACK="3" SMS_CONCAT="3" SMS_ESCALATE="1" -- cgit v1.2.3