new in scripting

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

you should not add and remove rules with scripts. better disable and enable existing (working) rules.

what u mean
i don’t understand

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"

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

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!

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]

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 :blush:

just write [f] in your script. [f] means ALL

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

tell me it’s gonna work and make me happy :laughing:

it should work fine

:smiley:
thanx man
preciated ur assistant

:cry:
help me :frowning: 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

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

how to make it work every day in the set time

just set interval to 24 hours