External accounting script help

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue May 12 18:51:00 CEST 2015


> On May 12, 2015, at 12:23 PM, Paul Boehmer <pboehmer at seidata.com> wrote:
> 
> ...And the first post is an epic fail.
> 
> Seems the code below works as advertised.  As a part of troubleshooting, I had erroneously put a stray "startrad" in my sites-enabled/default without a test condition, thus executing the script regardless of Acct-Status-Type.
> 

I was wondering how we overlooked such a major defect.

> That being said, am I on the right track as far as best practices?

Well other than using exec at all... sure. It really is horrifically slow, and there's not much we can do about that.

For 3.0.8 you might find the back ticks syntax is more convenient.

update {
	Tmp-String-0 := `/my/shell/script --arg '%{arg}'`
}

Behaviour changes based on the operator and LHS expression.

:= will copy stdout to the attribute Tmp-String-0.

<list>: += will look for attributes in the environment of the shell script and add them to the specified list.

The reason why the exec module is sticking around, is because it allows you toggle more stuff, like not waiting for the script to complete before continuing.

-Arran

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150512/df888514/attachment.sig>


More information about the Freeradius-Users mailing list