Page 1 of 1

Group configuration?

Posted: Sun May 31, 2009 9:13 am
by brotherdust
Hi guys,
I'm hoping someone has an idea on this one. I haven't seen anything on the boards for it, maybe I'm phrasing it wrong?
Here's the deal:
I've got a LOT of mikrotik devices. I am hoping there's a way to configure them all at once. For instance, I would just like to change the NTP servers, or what services are enabled, or the remote logging destination, on all my mikrotik devices at once, instead of dealing with them individually.

Any ideas?
Thanks!

Re: Group configuration?

Posted: Sun May 31, 2009 8:15 pm
by Chupaka
you may use *.auto.rsc file: upload it via ftp, and its contents will be executed

Re: Group configuration?

Posted: Tue Jun 02, 2009 2:34 am
by brotherdust
Awesome! Thanks! Is there a way to make the router automatically retrieve the file on some kind of scheduled basis?

Re: Group configuration?

Posted: Tue Jun 02, 2009 10:25 am
by normis
you could use the "/system scheduler" and the "/tool fetch"

Re: Group configuration?

Posted: Tue Jun 02, 2009 2:53 pm
by Chupaka
interesting question: will *.auto.npk/*.auto.rsc auto-execute in case you do not upload via ftp but download it via /tool fetch? =) just cannot test right now

Re: Group configuration?

Posted: Thu Jul 30, 2009 10:08 am
by shrek777
does anybody test it?

Re: Group configuration?

Posted: Thu Jul 30, 2009 1:30 pm
by Chupaka
just tested: neither '/tool fetch', nor drag'n'drop via WinBox do not execute *.auto.rsc files. you should still run '/import bla-bla-bla.auto.rsc'

even more: when I upload test.auto.rsc via FTP, it creates empty test.auto.log, and executes nothing. tested with ':log info "it works!"' and '/ip address add ***' commands. but after executing '/import test.auto.rsc' command, both test files do what they have to do. some kind of problem with policy in the light of recent changes in default policy for scripts/scheduler? MT Staff, please recheck =)

Re: Group configuration?

Posted: Thu Jul 30, 2009 1:31 pm
by normis
hmmm. ok, on it.

Re: Group configuration?

Posted: Thu Jul 30, 2009 1:32 pm
by Chupaka
Normis, you are faster than light!.. :lol:

Re: Group configuration?

Posted: Thu Jul 30, 2009 1:35 pm
by normis
v3.27 on Mips-be:
13:34:56 system,info,account user admin logged in from 192.168.88.254 via ftp
13:34:56 script,info it works!
13:36:18 system,info,account user admin logged out from 192.168.88.254 via ftp
Opening script file test.auto.rsc

Script file loaded successfully
Script file loaded and executed successfully

Re: Group configuration?

Posted: Thu Jul 30, 2009 1:39 pm
by mrz
Works for me too,
just tested: neither '/tool fetch', nor drag'n'drop via WinBox do not execute *.auto.rsc files. you should still run '/import bla-bla-bla.auto.rsc'
it will not work with winbox drag-n-drop and /tool fetch.
It works only when file is uploaded using ftp.

Re: Group configuration?

Posted: Thu Jul 30, 2009 2:08 pm
by Chupaka
v3.27, x86, Windows Explorer as FTP client

hmmm... it seems like it's working only immediately after connectiong to ftp...
13:56:28 system,info,account user admin logged in from 192.168.16.85 via ftp
13:56:59 system,info,account user admin logged out from 192.168.16.85 via ftp
[admin@MikroTik] > /file print 
 # NAME              TYPE             SIZE                 CREATION-TIME       
 0 test.auto.rsc     script           21                   jul/30/2009 13:56:47
 1 test.auto.log     .log file        0                    jul/30/2009 13:56:47
[admin@MikroTik] > 
but! if I connect to FTP, reboot the router and drag'n'drop the file to FTP - it reconnects, uploads the file, ROS executes it:
14:02:14 system,info,account user admin logged in from 192.168.16.85 via ftp
14:02:15 script,info it works!
[admin@MikroTik] > /file print 
 # NAME              TYPE             SIZE                 CREATION-TIME       
 0 test.auto.rsc     script           21                   jul/30/2009 14:02:14
 1 test.auto.log     .log file        114                  jul/30/2009 14:02:15
[admin@MikroTik] > 
Opening script file test.auto.rsc

Script file loaded successfully
Script file loaded and executed successfully
/file remove [find]
then again drag'n'drop the file to open FTP session - nothing added in Log,
[admin@MikroTik] > /file print 
 # NAME              TYPE             SIZE                 CREATION-TIME       
 0 test.auto.rsc     script           21                   jul/30/2009 14:04:36
 1 test.auto.log     .log file        0                    jul/30/2009 14:04:36
[admin@MikroTik] > 
recheck again?..

Re: Group configuration?

Posted: Thu Jul 30, 2009 2:10 pm
by normis
no matter what I do, I can't repeat your problem :)

Re: Group configuration?

Posted: Thu Jul 30, 2009 2:25 pm
by Chupaka
on x86? just tested with FAR File Manager as FTP client - the same thing, it executes uploaded script a few times after connecting to FTP, then begins to create empty log file even after reconnect...

ADDED: wow! when I copy the file again and overwrite previous one - it executes normally! some kind of trying to execute not fully uploaded file?..

Re: Group configuration?

Posted: Thu Aug 13, 2009 6:47 am
by tackerman
I have the same exact problem using the windows command line ftp client and programmatically from c#.
First upload, nothing, second time script runs.

Normis, what ftp client are you guys testing with?
Are you using binary or ASCII modes, passive? . . .

Re: Group configuration?

Posted: Thu Aug 13, 2009 7:37 am
by tackerman
More info:

This seems more likely to happen if one of these *.auto.rsc scripts is uploaded that takes a while and then it is re-uploaded while the first one was running. Then let the second uploaded script complete, deleting the rsc and log file and re-uploading a third copy seems to not run. Something like that. Confirmed this with both my mac command line client which uses passive mode by default and windows command line client.

To put windows ftp client into passive mode enter 'literal pasv' at the prompt.