mirror of https://github.com/kf7eel/hbnet.git
add local executable commands
This commit is contained in:
parent
3d877f6fc5
commit
eabf7df017
|
|
@ -98,6 +98,9 @@ import traceback
|
||||||
|
|
||||||
from socket import gethostbyname
|
from socket import gethostbyname
|
||||||
|
|
||||||
|
from data_gateway_local_commands import LOCAL_COMMANDS
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
|
|
@ -794,15 +797,15 @@ def process_sms(_rf_src, sms, call_type, system_name):
|
||||||
logger.error('User APRS messaging disabled.')
|
logger.error('User APRS messaging disabled.')
|
||||||
## if call_type == 'vcsbk':
|
## if call_type == 'vcsbk':
|
||||||
## send_sms(False, 9, 9, 9, 'group', 'APRS Messaging must be enabled. Send command "@APRS ON" or use dashboard to enable.')
|
## send_sms(False, 9, 9, 9, 'group', 'APRS Messaging must be enabled. Send command "@APRS ON" or use dashboard to enable.')
|
||||||
|
elif '%' in parse_sms[0]:
|
||||||
|
try:
|
||||||
|
## if parse_sms[0][1:] in LOCAL_COMMANDS:
|
||||||
|
|
||||||
## try:
|
logger.info('Executing command/script.')
|
||||||
## if sms in cmd_list:
|
subprocess.Popen(LOCAL_COMMANDS[parse_sms[0][1:]], shell=False)
|
||||||
## logger.info('Executing command/script.')
|
except Exception as error_exception:
|
||||||
## os.popen(cmd_list[sms]).read()
|
logger.info('Exception. Command possibly not in list, or other error.')
|
||||||
## packet_assembly = ''
|
logger.info(error_exception)
|
||||||
## except Exception as error_exception:
|
|
||||||
## logger.info('Exception. Command possibly not in list, or other error.')
|
|
||||||
## logger.info(error_exception)
|
|
||||||
## logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
## logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
||||||
## packet_assembly = ''
|
## packet_assembly = ''
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Python dictionary of commands that can be executed via SMS
|
||||||
|
# 'SMS':'COMMAND TO EXECUTE'
|
||||||
|
LOCAL_COMMANDS = {'ls':'ls',
|
||||||
|
'pwd':'pwd'}
|
||||||
Loading…
Reference in New Issue