Run perl script on filter

Support and queries relating to all previous versions of ZoneMinder
Locked
danielareas
Posts: 33
Joined: Thu Oct 26, 2006 6:00 pm

Run perl script on filter

Post by danielareas »

I'm tryng to execute de folowing comand : 'perl -w /usr/bin/human.pl' on a filter, but it doesn't work. I already tested the same command on the terminal window and it worked fine. The script was made to send an SMS message using a SMS serviçe in Brazil. The ZM version is 1.22.3 from Peter Howard. Below is the script that I saved in /usr/bin (human.pl):

#!/usr/bin/perl

require "config.cgi";
use CGI;
$cgi = new CGI;

##################################
&enviasms;

#####Código 1######
sub enviasms{

$dispatch = "send";
$account = "nome_da_conta";
$code = "codigo_da_conta";
$msg = "$msgx";
$from = "Nome da Empresa";
$to = "$cel";
$id = time();
$user = $id - 1;
$schedule = "";
$callbackOption = "";

$palavra = "000 - Message sent";

use LWP::Simple;

$resultado = get(" http://system.human.com.br:8080/Gateway ... backOption ");

if(!$resultado){
print "Não foi posivel uma comunicação com o servidor!";
} elsif($resultado =~/$palavra/i) {
print "SMS enviado com sucesso!";
}else{
print "SMS não foi enviado!";
}
}


I checked the syslog file and it says the perl script couldn't be found. Is it a permission problem?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

It could be, whats the permissions on the file?
danielareas
Posts: 33
Joined: Thu Oct 26, 2006 6:00 pm

Hostname

Post by danielareas »

I did a chown to the hostname.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The user you configured ZM to run as needs to be able to execute the script. So what are the permissions on the file?
danielareas
Posts: 33
Joined: Thu Oct 26, 2006 6:00 pm

Permissions

Post by danielareas »

I did a chmod 777 on the file, so it has all the possible permissions.

2230420 -rwxrwxrwx 1 root root 924 2007-08-22 19:41 human.pl

But the syslog file is sayng:

Aug 31 09:15:40 kokoon zmfilter[9934]: ERR [Auto execute script 'perl' not found, skipping filter 'Alarme_Noite']
danielareas
Posts: 33
Joined: Thu Oct 26, 2006 6:00 pm

Script folder

Post by danielareas »

Cordel,

I forgot to tell you that the human.pl script file is in the folder: /usr/bin

thank you,

Daniel
Locked