Daemon Support
Shebangs added to all files expected to be executed, command line argument for configuration file added (otherwise, it looks for dmrlink.cfg in the same directory as dmrlink.py) - this divorces it from the last ties to a shell environment… or at least I think.
This commit is contained in:
parent
cd217b94b5
commit
874b11db7b
11
bridge.py
11
bridge.py
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
||||||
#
|
#
|
||||||
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
||||||
@ -15,6 +17,15 @@ from binascii import b2a_hex as h
|
|||||||
import sys
|
import sys
|
||||||
from dmrlink import IPSC, NETWORK, networks, send_to_ipsc, dmr_nat, logger
|
from dmrlink import IPSC, NETWORK, networks, send_to_ipsc, dmr_nat, logger
|
||||||
|
|
||||||
|
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||||
|
__copyright__ = 'Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||||
|
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
|
||||||
|
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
|
||||||
|
__version__ = '0.2a'
|
||||||
|
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||||
|
__email__ = 'n0mjs@me.com'
|
||||||
|
__status__ = 'Production'
|
||||||
|
|
||||||
NAT = 0
|
NAT = 0
|
||||||
#NAT = '\x2f\x9b\x80'
|
#NAT = '\x2f\x9b\x80'
|
||||||
|
|
||||||
|
21
dmrlink.py
21
dmrlink.py
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
||||||
#
|
#
|
||||||
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
||||||
@ -9,6 +11,7 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import binascii
|
import binascii
|
||||||
import csv
|
import csv
|
||||||
@ -28,11 +31,18 @@ __author__ = 'Cortney T. Buffington, N0MJS'
|
|||||||
__copyright__ = 'Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group'
|
__copyright__ = 'Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||||
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
|
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
|
||||||
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
|
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
|
||||||
__version__ = '0.1'
|
__version__ = '0.2a'
|
||||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||||
__email__ = 'n0mjs@me.com'
|
__email__ = 'n0mjs@me.com'
|
||||||
__status__ = 'Production'
|
__status__ = 'Production'
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
|
||||||
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
#************************************************
|
#************************************************
|
||||||
# PARSE THE CONFIG FILE AND BUILD STRUCTURE
|
# PARSE THE CONFIG FILE AND BUILD STRUCTURE
|
||||||
#************************************************
|
#************************************************
|
||||||
@ -41,10 +51,13 @@ NETWORK = {}
|
|||||||
networks = {}
|
networks = {}
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
|
|
||||||
|
if not cli_args.CFG_FILE:
|
||||||
|
cli_args.CFG_FILE = os.path.dirname(os.path.abspath(__file__))+'/dmrlink.cfg'
|
||||||
try:
|
try:
|
||||||
config.read('./dmrlink.cfg')
|
if not config.read(cli_args.CFG_FILE):
|
||||||
except:
|
sys.exit('Configuration file \''+cli_args.CFG_FILE+'\' is not a valid configuration file! Exiting...')
|
||||||
sys.exit('Could not open configuration file, exiting...')
|
except:
|
||||||
|
sys.exit('Configuration file \''+cli_args.CFG_FILE+'\' is not a valid configuration file! Exiting...')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
|
11
log.py
11
log.py
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
||||||
#
|
#
|
||||||
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
||||||
@ -15,6 +17,15 @@ from binascii import b2a_hex as h
|
|||||||
import time
|
import time
|
||||||
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, get_info, int_id, subscriber_ids, peer_ids, talkgroup_ids, logger
|
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, get_info, int_id, subscriber_ids, peer_ids, talkgroup_ids, logger
|
||||||
|
|
||||||
|
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||||
|
__copyright__ = 'Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||||
|
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
|
||||||
|
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
|
||||||
|
__version__ = '0.2a'
|
||||||
|
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||||
|
__email__ = 'n0mjs@me.com'
|
||||||
|
__status__ = 'Production'
|
||||||
|
|
||||||
class logIPSC(IPSC):
|
class logIPSC(IPSC):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
11
rcm.py
11
rcm.py
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
|
||||||
#
|
#
|
||||||
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
# This work is licensed under the Creative Commons Attribution-ShareAlike
|
||||||
@ -21,6 +23,15 @@ import binascii
|
|||||||
import dmrlink
|
import dmrlink
|
||||||
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, get_info, int_id, subscriber_ids, peer_ids, talkgroup_ids, logger
|
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, get_info, int_id, subscriber_ids, peer_ids, talkgroup_ids, logger
|
||||||
|
|
||||||
|
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||||
|
__copyright__ = 'Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||||
|
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
|
||||||
|
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
|
||||||
|
__version__ = '0.2a'
|
||||||
|
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||||
|
__email__ = 'n0mjs@me.com'
|
||||||
|
__status__ = 'Production'
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
|
|
||||||
TS = {
|
TS = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user