I need to write a txt file on my web server every time a Ticket is locked.
I'm trying to do this using GenericAgent feature adding the following link on CMD field in "Ticket Command":
Code: Select all
/usr/bin/perl /opt/otrs/bin/myscript.pl
I can see the following OTRS logs:
Code: Select all
Thu Feb 5 09:54:46 2015 notice OTRS-CGI-40 Command returned a nonzero return code: rc=256, err=
Thu Feb 5 09:54:46 2015 notice OTRS-CGI-40 Execute '/usr/bin/perl /opt/otrs/bin/myscript.pl' for Ticket (XXXXXXXXXXXX/XXX).
Thu Feb 5 09:54:46 2015 notice OTRS-CGI-40 Run GenericAgent Job '1' from db.
Thu Feb 5 09:54:37 2015 notice OTRS-CGI-40 New GenericAgent job '1' added (UserID=2).
this is the content of myscript.pl:
Code: Select all
use strict;
use warnings;
use POSIX qw/strftime/;
open(my $fh, '>', 'result.txt');
print $fh "File written by Perl\n ";
print $fh strftime('%Y-%m-%d',localtime);
print $fh "\n ";
print $fh strftime ('%a %b %e %H:%M:%S %Y', gmtime);
close $fh;
- I have no file created after running the GenericAgent
- really sure I am missing something but I can't figure out what...
Any directions?
I'm using OTRS 3.3.3 on CentOS
Thanks in advance