Updated load file

This commit is contained in:
Deon George 2013-10-17 15:46:38 +11:00
parent 57389e462f
commit c4746712e3
2 changed files with 16 additions and 2 deletions

View File

@ -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']);
}

11
panel.sh Executable file
View File

@ -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