Page 1 of 1
new in scripting
Posted: Mon Feb 26, 2007 10:29 am
by wissammohamed
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
Posted: Mon Feb 26, 2007 10:30 am
by normis
you should not add and remove rules with scripts. better disable and enable existing (working) rules.
Posted: Mon Feb 26, 2007 2:33 pm
by wissammohamed
what u mean
i don't understand
Posted: Mon Feb 26, 2007 2:39 pm
by normis
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"
Posted: Tue Feb 27, 2007 3:55 pm
by wissammohamed
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
Posted: Tue Feb 27, 2007 4:04 pm
by normis
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!
Posted: Tue Feb 27, 2007 4:13 pm
by mrz
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]
Posted: Tue Feb 27, 2007 4:25 pm
by wissammohamed
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
Posted: Tue Feb 27, 2007 4:27 pm
by normis
just write [f] in your script. [f] means ALL
Posted: Tue Feb 27, 2007 4:36 pm
by wissammohamed
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
Posted: Tue Feb 27, 2007 4:47 pm
by wissammohamed
tell me it's gonna work and make me happy
Posted: Tue Feb 27, 2007 4:50 pm
by mrz
it should work fine
Posted: Tue Feb 27, 2007 4:56 pm
by wissammohamed
thanx man
preciated ur assistant
Posted: Wed Feb 28, 2007 3:42 pm
by wissammohamed
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
Posted: Wed Feb 28, 2007 10:39 pm
by mrz
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
Posted: Wed Feb 28, 2007 10:47 pm
by wissammohamed
how to make it work every day in the set time
Posted: Wed Feb 28, 2007 10:53 pm
by mrz
just set interval to 24 hours