Community discussions

MikroTik App
 
Linuxvil
just joined
Topic Author
Posts: 7
Joined: Mon Jun 06, 2016 12:51 pm

Disable ppp script

Mon Jul 04, 2022 5:33 pm

Greetings,
I need a script that in the absence of traffic or alternatively after 30 minutes disable the ppp connection.
I tried:
PPP - Profiles - 'my_profile' - script - On UP
{
: delay 1800;
/ppp secret disable $user;
/ppp active remove name=$user;
}
but it does not work. Any ideas on how to fix it?

I thank you all
Greetings
Marcello
 
Linuxvil
just joined
Topic Author
Posts: 7
Joined: Mon Jun 06, 2016 12:51 pm

Re: Disable ppp script  [SOLVED]

Tue Jul 05, 2022 11:10 am

I answer myself
:log warning ("Cliente $user connesso")
:delay 1800
/ppp secret disable $user
/ppp active remove [find name=$user]
:log warning ("Cliente $user disabilitato")

 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Disable ppp script

Tue Jul 05, 2022 2:31 pm

Perché complicare il pane?

Simply fixing the error do the results, why write all this?
And also OP has already fixed it.

Wrong syntax:
/ppp active remove name=$user
remove accept only "active" item(s) id(s)

Correct syntax:
/ppp active remove [find where name=$user]
find the "active" id of the desired name, and pass it to remove.


Instead
/ppp secret disable $user
disable accept or directly the username or
the "secret" username id, like remove
/ppp secret disable [find where name=$user]

but "active" id and "secret" id are not the same number, each section have it's own id for each users.

Who is online

Users browsing this forum: akkurad, UkRainUa and 20 guests