Page 1 of 1

Run perl script on filter

Posted: Thu Aug 23, 2007 12:42 pm
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?

Posted: Thu Aug 23, 2007 8:45 pm
by cordel
It could be, whats the permissions on the file?

Hostname

Posted: Thu Aug 23, 2007 9:52 pm
by danielareas
I did a chown to the hostname.

Posted: Thu Aug 23, 2007 10:14 pm
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?

Permissions

Posted: Fri Aug 31, 2007 12:26 pm
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']

Script folder

Posted: Fri Aug 31, 2007 12:29 pm
by danielareas
Cordel,

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

thank you,

Daniel