From c4746712e3c1ff8c16b215c6d0947117c9d7e56b Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 17 Oct 2013 15:46:38 +1100 Subject: [PATCH] Updated load file --- application/classes/Task/Event/Load.php | 7 +++++-- panel.sh | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 panel.sh diff --git a/application/classes/Task/Event/Load.php b/application/classes/Task/Event/Load.php index d39eb64..4d3e45f 100644 --- a/application/classes/Task/Event/Load.php +++ b/application/classes/Task/Event/Load.php @@ -19,11 +19,14 @@ class Task_Event_Load extends Minion_Task { if (! $params['file']) throw new Kohana_Exception('--file not supplied'); + $dir = dirname($params['file']); + $file = basename($params['file']); + $eo = new Event($params['file']); if (! $eo->save()) { if (! Kohana::$config->load('debug')->test_mode) - rename($params['file'],$params['file'].'.bad'); + rename($params['file'],$dir.'/bad-'.$file); echo 'Bad Event File: '.$params['file']; die(1); @@ -31,7 +34,7 @@ class Task_Event_Load extends Minion_Task { if (! Kohana::$config->load('debug')->test_mode) { if (Kohana::$config->load('config')->event_file_keep) - rename($params['file'],$params['file'].'.processed'); + rename($params['file'],$dir.'/processed-'.$file); else unlink($params['file']); } diff --git a/panel.sh b/panel.sh new file mode 100755 index 0000000..c71a5ad --- /dev/null +++ b/panel.sh @@ -0,0 +1,11 @@ +#!/bin/sh +echo $@ > /tmp/panel.sh.log + +CONFIG=/etc/asterisk/alarmreceiver.conf +DIR=$(/bin/grep eventspooldir ${CONFIG} 2>/dev/null|awk -F= '{print $2}' | sed -e 's/\ *//') + +[ -z "${DIR}" ] && echo "Cant find Alarm Dir in Config ${CONFIG}" && exit 1; + +for i in $(ls -1 ${DIR}/event-* 2>/dev/null); do + /usr/bin/php index.php task:load --file=${i} +done