Event-Triggered Shell Script

English! place to talk about development, programming and coding
Post Reply
sfault
Znuny newbie
Posts: 8
Joined: 21 Jun 2012, 11:57
Znuny Version: 3.0.9
Real Name: Ara

Event-Triggered Shell Script

Post by sfault »

I have a working module that is triggered by the TicketQueueUpdate event. I tried calling a shell script from my .pm file (tried exec() and system()) but I just can't seem to make it work. The shell script simply writes in a file (for testing purposes in the meantime). Do you have any ideas as to how I can make it work? Thank you very much!
sfault
Znuny newbie
Posts: 8
Joined: 21 Jun 2012, 11:57
Znuny Version: 3.0.9
Real Name: Ara

Re: Event-Triggered Shell Script

Post by sfault »

In case anyone's interested, for some unknown reason (or at least, unknown to me), I couldn't use exec() and system() when the perl script is online. So I tried to find another way and this is what finally made it work:

Code: Select all

open DATA, "bash /absolute_path [arg(s)] |"   or die "Couldn't execute program: $!";
close DATA;
Note: Even if the pm file is in the same folder as the bash script, I couldn't get it to work with just the relative path.

Thanks everyone for all the help (in my other questions, as well)! :D
Post Reply