I wrote this script, but it does not work correctly. Anyone can help?
He should check the restriction on the download and upload used by the user, and then perform some action, that is, remove the user from the active ppp list, but it has some disadvantages that I cannot get the value of the actual profile in the variable so I save instead the profile name in the comment with the user account of the user manager, to then get the profile name in the variable, but this is not the way I want it to be. Therefore, why, how to get the value of the actual profile in a variable, and also there is one problem. Why canβt I change the user account profile directly, I do it a long way, but in this way I lose the statistics of the user account, so that I do not lose the statistics of the user account and do the job as well.
SCRIPT V1.0:
:foreach i in=[/tool user-manager user find] do={
:global uname [/tool user-manager user get $i username];
:global upass [/tool user-manager user get $i password];
:global dused [/tool user-manager user get $i download-used];
:global uprofile [/tool user-manager user get $i comment];
:global dlimit [/tool user-manager profile limitation get [find name="$uprofile"] download-limit];
:if ($dused > $dlimit) do={
/ppp active remove [find name=$uname]
/tool user-manager user set $i disabled=yes
:log warning "$uname account has been disabled due to downloading limit exceeding";
/tool user-manager user remove $i
:log warning "$uname account is removed on package expiring";
/tool user-manager user add customer=admin disabled=no username=$uname password=$upass;
/tool user-manager user create-and-activate-profile $uname customer=admin profile="Expired User";
:log info "$uname account has been created again with expired profile";
}
}
script V1.0 :
, , , .
, , , . .
SCRIPT V2.0:
:foreach i in=[/tool user-manager user find] do={
:global uname [/tool user-manager user get $i username];
:global upass [/tool user-manager user get $i password];
:global dused [/tool user-manager user get $i download-used];
:global uprofile [/tool user-manager user get $i comment];
:global dlimit [/tool user-manager profile limitation get [find name="$uprofile"] download-limit];
:if ($dused > $dlimit) do={
:global uip [/tool user-manager user get $i ip-address];
:global hostip [:pick $uip 11 14];
/tool user-manager user set $i ip-address="10.10.10.$hostip"
/ppp active remove [find name=$uname]
:log warning "$uname has been assigned to expired ip pool with ip 10.10.10.$hostip";
}
}
script V2.0 :
, IP-, ip , IP-, IP- , ip, , , - ip , , , , ..!
... , , ..!: D