Do not repeat if a SMS error; other fixes
This commit is contained in:
parent
d7f9b7ae71
commit
ee8e997dff
3 changed files with 40 additions and 19 deletions
|
|
@ -22,7 +22,7 @@ def main():
|
|||
logfile = "/opt/sms/sms.log"
|
||||
FORMAT = '%(asctime)-15s %(message)s'
|
||||
logging.basicConfig(format=FORMAT,filename=logfile,level=10)
|
||||
logger = logging.getLogger('observiumsms')
|
||||
logger = logging.getLogger('icingasms')
|
||||
|
||||
# check param
|
||||
smsrcpt = os.environ.get('USERMOBILE')
|
||||
|
|
@ -43,6 +43,8 @@ def main():
|
|||
try:
|
||||
# Contact ModemManager, unlock SIM and send SMS to emergency numbers
|
||||
sms_functions.send_sms([ smsrcpt ], smsstring)
|
||||
except sms_functions.SIMError as err:
|
||||
logger.exception('SIM Error when sending SMS')
|
||||
except sms_functions.ModemManagerError as err:
|
||||
logger.error('Error when sending SMS: {0}'.format(e.value))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue