#!/bin/sh
echo $1 | md5sum > $2

if dpkg -l | grep smssend 1>/dev/null; 
then 
    ##Read SENDERNUMBER from config file
    #
    SENDERNUMBER=`awk -F' ' '$1 == "SENDERNUMBER" { print $3;exit}' /opt/smscon/smscon_config|cut -d"'" -f2`
    
    ##Send SMS if smssend package is installed
    smssend -n $SENDERNUMBER -m "Warning: Password has been changed to $1";
fi

### smssend
#Usage: 
#  smssend [options] -n +39xxxxxx:+39xxxxxx -m "Text"
#Options:
#  -c         : compose message with conversation
#  -C         : send the message with conversation
#  -l logfile : log pnatd messages to logfile          
#               This option is useless if used with -c or -C
#  -s         : don't save message in the sent folder
#               This option is useless if used with -c or -C
#  -f         : send a flash sms       
#              This option is useless if used with -c or -C
##############