Community discussions

MikroTik App
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

new in scripting

Mon Feb 26, 2007 10:29 am

hi guys
i use webproxt-test
in the proxy i blocked users to download video (avi , mpg .wma , wmv .... )

ip proxy access add path=avi action=deny
ip proxy access add path=:.mpg action=deny
ip proxy access add path=:.wma action=deny
ip proxy access add path=:.wmv action=deny



now i need to allow users to download these extension from 12am to 6am
so i scripted these rules and schedule it


[admin@MikroTik] > system script print
0 name="n3" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source=ip proxy access add path=:.avi action=allow

1 name="n1" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source=ip proxy access add path=:.mpg action=allow

2 name="n2" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source=ip proxy access add path=:.wma action=allow

3 name="n4" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source=ip proxy access add path=:.wma action=allow


and i

[admin@MikroTik] > system scheduler print
Flags: X - disabled
# NAME ON-EVENT START-DATE START-TIME INTERVAL RUN-COUNT
0 night n1\r\nn2\r\nn3\r\nn4 feb/24/2007 00:00:00 6m 7

what's wrong with these rules
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26914
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Mon Feb 26, 2007 10:30 am

you should not add and remove rules with scripts. better disable and enable existing (working) rules.
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Mon Feb 26, 2007 2:33 pm

what u mean
i don't understand
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26914
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Mon Feb 26, 2007 2:39 pm

not like this
2 name="n2" owner="admin" policy=ftp,read,write,policy,winbox run-count=0 source="ip proxy access add path=:.wma action=allow"
but like this
2 name="n2" owner="admin" policy=ftp,read,write,policy,winbox run-count=0 source="ip proxy access enable NAME"

 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Tue Feb 27, 2007 3:55 pm

thanx for ur replay normis
ok i do this i hope it's right

proxy

ip proxy access add path=avi action=deny
ip proxy access add path=:.mpg action=deny
ip proxy access add path=:.wma action=deny
ip proxy access add path=:.wmv action=deny


script


[admin@MikroTik] > system script print
0 name="mpg" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source="ip proxy access enable mpg"

1 name="wma" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source="ip proxy access enable wma"

2 name="avi" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source="ip proxy access enable avi"

3 name="wmv" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source="ip proxy access enable wmv"



scheduler


[admin@MikroTik] > sys scheduler print
Flags: X - disabled
# NAME ON-EVENT START-DATE START-TIME INTERVAL RUN-COUNT
0 avi avi jan/01/2007 01:00:00 0s 0
1 wma wma jan/01/2007 01:00:00 0s 0
2 mpg mpg jan/01/2007 01:00:00 0s 0
3 wmv wmv jan/01/2007 01:00:00 0s 0


ok now i scheduled to enable downloading these extention at 1 am
now how to disable it at 6 am

thanx again
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26914
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Tue Feb 27, 2007 4:04 pm

add new scripts that will do the disable, and then add another scheduler rule that will run those other scripts. it's the same as you have now!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Tue Feb 27, 2007 4:13 pm

It's not gonna work
ip proxy access enable mpg
as enable command expects item number

To enable all entries in access list use:
/ip proxy access enable [f]
And to disable use:
/ip proxy access disable [f]
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Tue Feb 27, 2007 4:25 pm

what do mean [f]


i do not understand what u mean by that [f]


can u do it for me

plz

im new in mikrotik :oops:
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26914
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Tue Feb 27, 2007 4:27 pm

just write [f] in your script. [f] means ALL
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Tue Feb 27, 2007 4:36 pm

ok thanx

i did this

[admin@MikroTik] > system script print
0 name="block_download" owner="admin" policy=ftp,read,write,policy,winbox run-count=0
source="ip proxy access disable [f]"

1 name="open_download" owner="admin" policy=ftp,read,write,policy,winbox run-count=0 source="ip proxy access enable [f]"


[admin@MikroTik] > sys scheduler print
Flags: X - disabled
# NAME ON-EVENT START-DATE START-TIME INTERVAL RUN-COUNT
0 block_download block_download jan/01/2007 06:00:00 0s 0
1 open_download open_download jan/01/2007 01:00:00 0s 0
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Tue Feb 27, 2007 4:47 pm

tell me it's gonna work and make me happy :lol:
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Tue Feb 27, 2007 4:50 pm

it should work fine
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Tue Feb 27, 2007 4:56 pm

:D
thanx man
preciated ur assistant
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Wed Feb 28, 2007 3:42 pm

:cry:
help me :( it's not working
in 1am it's work fine (enable to download avi,mpg ......)
but at 6am it's does't disable it
im crying now
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Wed Feb 28, 2007 10:39 pm

you have to set interval for sys scheduler rules. In your case it runs only
once
jan/01/2007 01:00:00 and
jan/01/2007 06:00:00
 
wissammohamed
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 85
Joined: Fri Jan 05, 2007 3:29 pm

Wed Feb 28, 2007 10:47 pm

how to make it work every day in the set time
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Wed Feb 28, 2007 10:53 pm

just set interval to 24 hours

Who is online

Users browsing this forum: No registered users and 17 guests