Hi,
Can someone help me solve this problem I having to run the script listed below, from the command line on the filter window. When I try to run from the terminal, it runs perfectly, but when I try to run it from the filter command line,I get the folowing message from zmfilter.log:
02/09/08 09:50:23.503750 zmfilter[8098].DBG [Checking event 1213]
02/09/08 09:50:23.503902 zmfilter[8098].INF [Executing '/usr/bin/zmserial.pl 1/1213']
02/09/08 09:50:24.433664 zmfilter[8098].DBG [Output: ]
02/09/08 09:50:24.434049 zmfilter[8098].ERR [Command '/usr/bin/zmserial.pl 1/1213' exited with status: 9]
SCRIPT:
#!/usr/bin/perl -w
use strict;
use bytes;
use constant DBG_ID => "zmserial"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 1; # 0 is errors, warnings and info only, > 0 for debug
use ZoneMinder::Trigger::Connection;
use ZoneMinder::Trigger::Channel::Serial;
my @connections;
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) );
use ZoneMinder;
use DBI;
use Data::Dumper;
use POSIX qw( EINTR );
use Time::HiRes qw( usleep );
$| = 1;
$ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, level=>DBG_LEVEL );
zmDbgSetSignal();
foreach my $connection ( @connections )
{
$connection->open();
sleep (5);
}
Thank you,
Daniel Areas
Runnining a script from filter to trigger serial port error
-
- Posts: 33
- Joined: Thu Oct 26, 2006 6:00 pm
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
I suspect this will turn out to be a permissions problem. It's worth checking zmpkg.log znd zmdc.log as well as your httpd error log as sometimes errors seem to get propagated up and not appear in the most obvious log. You could also try running your script direct as the web user via su or sudo to see what happens.
Phil
-
- Posts: 33
- Joined: Thu Oct 26, 2006 6:00 pm
-
- Posts: 33
- Joined: Thu Oct 26, 2006 6:00 pm
This are actualy difined in linux, a good litle read as well:
http://linux.about.com/od/commands/l/blcmdl7_signal.htm
http://linux.about.com/od/commands/l/blcmdl7_signal.htm
-
- Posts: 33
- Joined: Thu Oct 26, 2006 6:00 pm
Script for Serial Port
Thank you for your reply, but I need to know why the error occurs in the command to open the serial port when the script is called by the filter. When I run the same script in the terminal window with the user 'sudo', the serial port is opened and works fine, with the user ´home´, it shows the following error: "Can't open log file '/tmp/zmserial.log': Permission denied at /usr/share/perl5/ZoneMinder/Debug.pm line 279", after that, I grant the permission: "sudo chmod 777 /usr/bin/zmserial.log" e "sudo chmod 777 /usr/share/perl5/ZoneMinder/*.*" and the script runs fine. I´ve checked the logs zmpkg.log and zmdc.log like Phil suggested and didn´t find any errors. I´m using version 1.22.3-10 packed by Peter Howard running on UBUNTU 6.06 Dapper. Any suggestions will be welcome.
Daniel Areas
Daniel Areas