cc-4105: updated config and installation scripts
This commit is contained in:
parent
843dd664e3
commit
b22b9b9aa3
|
@ -8,7 +8,7 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
media_monitor_path="/usr/lib/airtime/media-monitor/"
|
media_monitor_path="/usr/lib/airtime/media-monitor/"
|
||||||
media_monitor_script="media_monitor.py"
|
media_monitor_script="media_monitor.py"
|
||||||
|
|
||||||
api_client_path="/usr/lib/airtime/"
|
api_client_path="/usr/lib/airtime/:/usr/lib/airtime/media-monitor/mm2/"
|
||||||
|
|
||||||
cd ${media_monitor_path}
|
cd ${media_monitor_path}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,9 @@ try:
|
||||||
#copy python files
|
#copy python files
|
||||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||||
# mm2
|
# mm2
|
||||||
#copy_dir("%s/../../media-monitor2/"%current_script_dir, config["bin_dir"])
|
mm2_source = os.path.realpath(os.path.join(current_script_dir,
|
||||||
|
"../../media-monitor2"))
|
||||||
|
copy_dir(mm2_source, os.path.join( config["bin_dir"], "mm2" ))
|
||||||
|
|
||||||
#copy init.d script
|
#copy init.d script
|
||||||
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
||||||
|
|
|
@ -21,12 +21,11 @@ rabbitmq_vhost = '/'
|
||||||
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
|
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
|
||||||
check_airtime_events = 30 #how long to queue metadata input from airtime.
|
check_airtime_events = 30 #how long to queue metadata input from airtime.
|
||||||
|
|
||||||
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
|
|
||||||
check_airtime_events = 30 #how long to queue metadata input from airtime.
|
|
||||||
|
|
||||||
# MM2 only:
|
# MM2 only:
|
||||||
touch_interval = 5
|
touch_interval = 5
|
||||||
chunking_number = 450
|
chunking_number = 450
|
||||||
request_max_wait = 3.0
|
request_max_wait = 3.0
|
||||||
rmq_event_wait = 0.5
|
rmq_event_wait = 0.5
|
||||||
logpath = '/var/log/airtime/media-monitor/mm2.log'
|
logpath = '/var/log/airtime/media-monitor/media-monitor.log'
|
||||||
|
index_path = '/var/tmp/airtime/media-monitor/last_index'
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
import mm2.mm2 as mm2
|
||||||
from std_err_override import LogWriter
|
from std_err_override import LogWriter
|
||||||
# configure logging
|
|
||||||
try:
|
|
||||||
logging.config.fileConfig("logging.cfg")
|
|
||||||
|
|
||||||
#need to wait for Python 2.7 for this..
|
global_cfg = '/etc/airtime/media-monitor.cfg'
|
||||||
#logging.captureWarnings(True)
|
api_client_cfg = '/etc/airtime/api_client.cfg'
|
||||||
|
logging_cfg = '/usr/lib/airtime/media-monitor/logging.cfg'
|
||||||
|
|
||||||
logger = logging.getLogger()
|
mm2.main( global_cfg, api_client_cfg, logging_cfg )
|
||||||
LogWriter.override_std_err(logger)
|
|
||||||
|
|
||||||
except Exception, e:
|
|
||||||
print 'Error configuring logging: ', e
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print("testing")
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ import media.monitor.pure as mmp
|
||||||
from api_clients import api_client as apc
|
from api_clients import api_client as apc
|
||||||
|
|
||||||
|
|
||||||
def main(global_config, api_client_config, log_config):
|
def main(global_config, api_client_config, log_config,
|
||||||
|
index_create_attempt=False):
|
||||||
for cfg in [global_config, api_client_config]:
|
for cfg in [global_config, api_client_config]:
|
||||||
if not os.path.exists(cfg): raise NoConfigFile(cfg)
|
if not os.path.exists(cfg): raise NoConfigFile(cfg)
|
||||||
# MMConfig is a proxy around ConfigObj instances. it does not allow
|
# MMConfig is a proxy around ConfigObj instances. it does not allow
|
||||||
|
@ -40,8 +41,8 @@ def main(global_config, api_client_config, log_config):
|
||||||
print("Unknown error reading configuration file: '%s'" % global_config)
|
print("Unknown error reading configuration file: '%s'" % global_config)
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
# TODO : use the logging config file.
|
|
||||||
logging.config.fileConfig(log_config)
|
#logging.config.fileConfig(log_config)
|
||||||
|
|
||||||
#need to wait for Python 2.7 for this..
|
#need to wait for Python 2.7 for this..
|
||||||
#logging.captureWarnings(True)
|
#logging.captureWarnings(True)
|
||||||
|
@ -51,6 +52,26 @@ def main(global_config, api_client_config, log_config):
|
||||||
logfile = unicode( config['logpath'] )
|
logfile = unicode( config['logpath'] )
|
||||||
setup_logging(logfile)
|
setup_logging(logfile)
|
||||||
log = get_logger()
|
log = get_logger()
|
||||||
|
|
||||||
|
if not index_create_attempt:
|
||||||
|
if not os.path.exists(config['index_path']):
|
||||||
|
log.info("Attempting to create index file:...")
|
||||||
|
try:
|
||||||
|
f = open(config['index_path'])
|
||||||
|
f.write(" ")
|
||||||
|
f.close()
|
||||||
|
except Exception as e:
|
||||||
|
log.info("Failed to create index file with exception: %s" % str(e))
|
||||||
|
else:
|
||||||
|
log.info("Created index file, reloading configuration:")
|
||||||
|
main( global_config, api_client_config, log_config,
|
||||||
|
index_create_attempt=True )
|
||||||
|
else:
|
||||||
|
log.info("Already tried to create index. Will not try again ")
|
||||||
|
|
||||||
|
if not os.path.exists(config['index_path']):
|
||||||
|
log.info("Index file does not exist. Terminating")
|
||||||
|
|
||||||
log.info("Attempting to set the locale...")
|
log.info("Attempting to set the locale...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue