G1sms/shell/init.sh.template

32 lines
922 B
Bash
Executable File

#!/bin/bash
##################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
##################################################################
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () {
# log ($1=text)
if [ "$DOLOG" == "YES" ]
then
echo "$PHONE:$1" >> $LOG_FILE
fi
}
### Déclaration de l'environnement
source .env
fn_exists() {
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
[ `type -t $1`"" == 'file' ]
}
# ATOMATIC gammu-smsd-inject desactivation if no gammu is installed on system
if ! fn_exists gammu-smsd-inject; then
log ":p) DESACTIVATION ENVOI DE SMS .............."
function gammu-smsd-inject () {
log "$PHONE: >>> SENDING SMS $4 TO $2 "
}
else
export G1SMS="YES"
fi