Fwd: [rt-users] Execute Arbitrary Perl Script on resolve

Bruce Campbell bruce_campbell at ripe.net
Fri May 31 16:20:35 EDT 2002


On Fri, 31 May 2002, Smylers wrote:

> Yesterday Michael Grubb wrote:
>
> > Anyway if you *REALLY* want to just execute external perl code you
> > could do something like this:  <snip>
> >
> >     open(EXTPRG, "<" . $self->Argument()) or return 0;
> >     while(<EXTPRG>) { $prog_txt .= $_ }
> >     close(EXTPRG) or return 0;
>
> Surely the above open, while, close, and eval can be simplified to:
>
>   do $self->Argument();
>
> Possibly you'd want to make sure the external script always returns true
> if it succeeds, so that the return code gets propagated properly.

Actually, if you want some perl code that will allow you to pipe something
(the current transaction) to an arbitary command _and_ reading the output,
_and_ being able to kill the command after an arbitary timeout, try:

	http://www.fsck.com/rtfm/factoid.html?id=153

The above is part of a ScripAction that I'm wanting to finish that does
essentially 'execute arbitary perl code' ($self->Argument, although
checking to make sure one can execute it ;) ), although I'm intending to
finish it as part of a ScripAction tutorial when I get spare time (and
that'll probably be when I next get pissed off at spam in my queues and
want SpamAssassin on it ;) )

-- 
                             Bruce Campbell                            RIPE
                   Systems/Network Engineer                             NCC
                 www.ripe.net - PGP562C8B1B                      Operations

'What would be the killer app assuming serious sized bandwidth?'
'Obvious.  More bits per boob.'
	-- Q&A from SANE2002 inSANE quiz.





More information about the rt-users mailing list