Community discussions

MUM Europe 2020
 
headshoter
just joined
Topic Author
Posts: 18
Joined: Mon Jul 30, 2012 3:21 am

Daily traffic limit on userman

Sun Aug 03, 2014 11:24 pm

Hello,
i want to use an script to add some traffic to userman users daily,
then i wrote the below script ,
in this sample i set profiles validity to 1 day , and add the profile to each user daily .
i used comment attribute to save the profile that should be added to users daily (i didnt use actual-profile attribute because if a user use all of his/her traffic on a day , the actual-profile value will become null !! )
:foreach MyUser in=[/tool user-manager user find customer=mozafar and comment!="Unlimited" and comment!="256-128(un)" and comment!="512-128(un)" ] \
do={[/tool user-manager user create-and-activate-profile customer=mozafar profile=[/tool user-manager user get value-name=comment $MyUser ] numbers=$MyUser ] [/tool user-manager user reset-counters $MyUser]}
but i was wonder if there is better/optimized way to do this?

any helps would be highly appreciated :)
 
headshoter
just joined
Topic Author
Posts: 18
Joined: Mon Jul 30, 2012 3:21 am

Re: Daily traffic limit on userman

Mon Aug 04, 2014 8:02 pm

I got a problem with the above script ,
if i enter wrong profile name in comment of some user , the rest of my loop will be interrupted,
for example i have one profile named "512(500MB)" , if i add for example 512(500) to some user (for example user number 5) as comment, the rest of loop will not work also for users after user number 5 ...

is there anyway that i can first check the comment to see if its available in profiles , and if it was available the create-and-activate-profile for that user ?

Who is online

Users browsing this forum: No registered users and 12 guests