<div dir="ltr">Dear Arran i see in log file that first executing preacct section and then <font color="#000000"> UPDATE radacct by AcctStopTime .. if i need to change that record i need to </font>Executing my perl script or uunlang script after database updated with <span style="color:rgb(0,0,0)"> AcctStopTime so do i need chnage the location of this :</span><div>
<font color="#000000"><br></font></div><div><font color="#0000ff"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">preacct {</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">
<span style="font-family:arial,sans-serif;font-size:12.800000190734863px"> if (Acct-Status-Type == 'Stop') {</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"></font><div class="im" style="font-family:arial,sans-serif;font-size:12.800000190734863px">
<font color="#0000ff"> <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay><br> }<br>} </font></div><div class="im" style="font-family:arial,sans-serif;font-size:12.800000190734863px">
<br></div><div class="im" style="font-family:arial,sans-serif;font-size:12.800000190734863px"><br></div><div class="im" style="font-family:arial,sans-serif;font-size:12.800000190734863px">LOG file : </div><div><br></div><div>
[<thread>] # <font color="#ff0000">Executing section preacct from file /usr/local/etc/raddb/sites-enabled/default</font></div><div># Executing section accounting from file /usr/local/etc/raddb/sites-enabled/default</div>
<div>rlm_sql (sql): Reserving sql socket id: 0</div><div>rlm_sql_postgresql: query: START TRANSACTION</div><div>rlm_sql_postgresql: Status: PGRES_COMMAND_OK</div><div>rlm_sql_postgresql: query affected rows = 0</div><div>
rlm_sql_postgresql: query: UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', expiry_time = 'now'::timestamp(0) - '1 second'::interval WHERE nasipaddress = '78.39.54.132' AND pool_key = '32' AND username = 'test1' AND callingstationid = '188.245.240.75' AND framedipaddress = '192.168.90.100'</div>
<div>rlm_sql_postgresql: Status: PGRES_COMMAND_OK</div><div>rlm_sql_postgresql: query affected rows = 1</div><div>rlm_sql_postgresql: query: COMMIT</div><div>rlm_sql_postgresql: Status: PGRES_COMMAND_OK</div><div>rlm_sql_postgresql: query affected rows = 0</div>
<div>Released IP 192.168.90.100 (did 78.39.54.132 cli 188.245.240.75 user test1)</div><div>rlm_sql (sql): Released sql socket id: 0</div><div>rlm_sql (sql): Reserving sql socket id: 4</div><div>rlm_sql_postgresql: query:<font color="#ff0000"> UPDATE radacct SET AcctStopTime = ('2013-03-07 07:31:04'::timestamp - '0'::interval), AcctSessionTime = CASE WHEN '176' = '' THEN (EXTRACT(EPOCH FROM ('2013-03-07 07:31:04'::TIMESTAMP WITH TIME ZONE - AcctStartTime::TIMESTAMP WITH TIME ZONE - '0'::INTERVAL)))::BIGINT ELSE NULLIF('176','')::BIGINT END, AcctInputOctets = (('0'::bigint << 32) + '28689'::bigint), AcctOutputOctets = (('0'::bigint << 32) + '80'::bigint), AcctTerminateCause = 'NAS-Request', AcctStopDelay = 0, FramedIPAddress = NULLIF('192.168.90.100', '')::inet, ConnectInfo_stop = '' WHERE AcctSessionId = '81000016' AND UserName = 'test1' AND NASIPAddress = '78.39.54.132' AND AcctStopTime IS NULL</font></div>
<div>rlm_sql_postgresql: Status: PGRES_COMMAND_OK</div><div>rlm_sql_postgresql: query affected rows = 1</div><div>rlm_sql (sql): Released sql socket id: 4</div><div>Ready to process requests.</div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Mar 3, 2013 at 8:30 PM, Arran Cudbard-Bell <span dir="ltr"><<a href="mailto:a.cudbardb@freeradius.org" target="_blank">a.cudbardb@freeradius.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On 3 Mar 2013, at 11:32, Mehdi Ravanbakhsh <<a href="mailto:babakco@gmail.com">babakco@gmail.com</a>> wrote:<br>
<br>
> Hello everyone<br>
><br>
> I need to update some check and replay attribute in database when get stop in accounting and the session is finish<br>
><br>
> i need to know in which section of virtual server file ( sites-enabled/default) i need to put unlang script (and/or perl script) ?<br>
><br>
> and<br>
><br>
</div>> how i can check in script if accounting get stop packet , .<br>
<br>
preacct {<br>
if (Acct-Status-Type == 'Stop') {<br>
<div class="im"> <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay><br>
}<br>
}<br>
<br>
</div>-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br>
</blockquote></div><br></div>