<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote
 style="border-left: 2px solid rgb(0, 153, 0) ! important; border-right: 2px solid rgb(0, 153, 0) ! important; margin: 8px 2px; padding: 0px 15px;"
 cite="mid:4A041168.6040201@deployingradius.com" type="cite"><span
 style="font-family: Arial; font-size: 12px; font-weight: normal;"
 class="headerSpan">Alan DeKok ha scritto:<br>
  <br>
  </span>
  <pre wrap="">Gianni Olivieri wrote:
  </pre>
  <blockquote
 style="border-left: 2px solid rgb(0, 153, 0) ! important; border-right: 2px solid rgb(0, 153, 0) ! important; margin: 8px 2px; padding: 0px 15px;"
 type="cite">
    <pre wrap="">Hi to all,

  in a previous verison of freeradius I use the acct_users file to
launch a python script after login/logout of a user.

the acct_users was so:

DEFAULT         Acct-Status-Type == "Start"
               Exec-Program = "/etc/freeradius/SCRIPT/userlogin.py
%{User-Name}"
DEFAULT         Acct-Status-Type == "Stop"
               Exec-Program = "/etc/freeradius/SCRIPT/userlogout.py
%{User-Name}

Now with freeradius 2.0.4 this acct_users doesn't work.
How can launch a script after a login and a logout?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  You will need to use the "exec" module:

DEFAULT Acct-Status-Type == "Start"
        Tmp-String-0 = "%{exec:/etc/freeradius/SCRIPT/userlogin.py}"

  That will also cause the script to execute immediately.  Or, you can
use "unlang":

accounting {
        ...


        if (Acct-Status-Type == Start) {
                update reply {
                        Tmp-String-0 = "%{exec:/etc/freeradius/SCRIPT/userlogin.py}"
                }
        
        }
}

  </pre>
</blockquote>
thanks for the reply... but there is some error in my conf... now my
acct_users is:<br>
<br>
radius:/etc/freeradius/sites-enabled# cat ../acct_users<br>
DEFAULT         Acct-Status-Type == "Start"<br>
                Tmp-String-0 =
"%(exec:/etc/freeradius/SCRIPT/userlogin.py User-Name)"<br>
DEFAULT         Acct-Status-Type == "Stop"<br>
                Tmp-String-0 =
"%(exec:/etc/freeradius/SCRIPT/userlogout.py User-Name)"<br>
<br>
<br>
and when I launch freeradius:<br>
/etc/freeradius/acct_users[2]: Parse error (reply) for entry DEFAULT:
Invalid octet string "%(exec:/etc/freeradius/SCRIPT/userlogin.py
User-Name)" for attribute name "Tmp-String-0"<br>
Errors reading /etc/freeradius/acct_users<br>
<br>
I must initialize Tmp-String-0? I must also pass the UserName to my
script....<br>
<br>
Best regards.<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Gianni Olivieri
SICE Telecomunicazioni
------------------------------------
Via Tazio Nuvolari, 53
55061 - Carraia (LU) - ITALY
------------------------------------------------
Tel. +39 0583 980787
Fax +39 0583 981495
<a class="moz-txt-link-abbreviated" href="http://www.sicetelecom.it">www.sicetelecom.it</a>
<a class="moz-txt-link-abbreviated" href="mailto:gianni.olivieri@sicetelecom.it">gianni.olivieri@sicetelecom.it</a>
----------------------------------------------- </pre>
</body>
</html>