26 lines
604 B
Python
Executable File
26 lines
604 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import logging
|
|
import os
|
|
import sys
|
|
from pydbus import SystemBus
|
|
from gi.repository import GLib
|
|
import sms_functions
|
|
|
|
# Setup logging
|
|
logfile = "/opt/sms/sms.log"
|
|
FORMAT = '%(asctime)-15s %(message)s'
|
|
logging.basicConfig(format=FORMAT,filename=logfile,level=10)
|
|
logger = logging.getLogger('observiumsms')
|
|
|
|
if len(sys.argv) < 3:
|
|
raise Exception('Not enough arguments')
|
|
|
|
# Assemble SMS
|
|
smsstring = sys.argv[1]
|
|
nums = sys.argv[2:]
|
|
logger.info("Sending SMS: %s", smsstring)
|
|
|
|
# Contact ModemManager, unlock SIM and send SMS to emergency numbers
|
|
sms_functions.send_sms(nums, smsstring)
|