How to run a perl script
Hi I would like to run a perl script, using rlm_perl, at specific times. For example, when a Stop request comes in run stop.pl, when an interim-update comes in run update.pl. Can someone tell me where to do this. I am sorry if my question seems vague but I am fairly lost. I can write the script I just don't know how to call it. Any assistance would be appreciated. Thanks
On 21/07/11 13:45, Tyller D wrote:
Hi
I would like to run a perl script, using rlm_perl, at specific times.
For example, when a Stop request comes in run stop.pl <http://stop.pl>, when an interim-update comes in run update.pl <http://update.pl>.
Can someone tell me where to do this. I am sorry if my question seems vague but I am fairly lost. I can write the script I just don't know how to call it.
You've already said you want to use "rlm_perl". Have you read the sample config "raddb/modules/perl" and the same scripts that comes with the server source, "src/modules/rlm_perl/example.pl"? Basically, you just: 1. Define a perl module - see raddb/modules/perl for an example 2. Put it in the server config at the point you want to run it
On Thu, Jul 21, 2011 at 7:45 PM, Tyller D <tyllerd@gmail.com> wrote:
Hi
I would like to run a perl script, using rlm_perl, at specific times.
For example, when a Stop request comes in run stop.pl, when an interim-update comes in run update.pl.
Can someone tell me where to do this. I am sorry if my question seems vague but I am fairly lost. I can write the script I just don't know how to call it.
Any assistance would be appreciated.
Option 1: use combination of unlang (to select accounting packet type) and rlm_exec (see modules/echo for example). This way the perl script will be treated just like any other executable (not using rlm_perl, I know, but some people might find it simpler) Option 2: use rlm_perl, read modules/perl. You need to know about creating functions in perl. Some snippet from that file: ... # The following hashes are given to the module and # filled with value-pairs (Attribute names and values) # # %RAD_CHECK Check items # %RAD_REQUEST Attributes from the request # %RAD_REPLY Attributes for the reply ... # # List of functions in the module to call. # Uncomment and change if you want to use function # names other than the defaults. # #func_authenticate = authenticate #func_authorize = authorize #func_preacct = preacct #func_accounting = accounting ... The function assigned to func_accounting should then be able to differentiate whether it's an accounting stop or interim-update by looking at values on %RAD_REQUEST. -- Fajar
participants (3)
-
Fajar A. Nugraha -
Phil Mayers -
Tyller D