Community discussions

MikroTik App
 
brotherdust
Member Candidate
Member Candidate
Topic Author
Posts: 130
Joined: Tue Jun 05, 2007 1:31 am

Group configuration?

Sun May 31, 2009 9:13 am

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!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Sun May 31, 2009 8:15 pm

you may use *.auto.rsc file: upload it via ftp, and its contents will be executed
 
brotherdust
Member Candidate
Member Candidate
Topic Author
Posts: 130
Joined: Tue Jun 05, 2007 1:31 am

Re: Group configuration?

Tue Jun 02, 2009 2:34 am

Awesome! Thanks! Is there a way to make the router automatically retrieve the file on some kind of scheduled basis?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 27011
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Re: Group configuration?

Tue Jun 02, 2009 10:25 am

you could use the "/system scheduler" and the "/tool fetch"
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Tue Jun 02, 2009 2:53 pm

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
 
shrek777
Member Candidate
Member Candidate
Posts: 264
Joined: Wed Jan 21, 2009 9:44 am

Re: Group configuration?

Thu Jul 30, 2009 10:08 am

does anybody test it?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Thu Jul 30, 2009 1:30 pm

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 =)
Last edited by Chupaka on Thu Jul 30, 2009 1:31 pm, edited 1 time in total.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 27011
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Re: Group configuration?

Thu Jul 30, 2009 1:31 pm

hmmm. ok, on it.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Thu Jul 30, 2009 1:32 pm

Normis, you are faster than light!.. :lol:
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 27011
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Re: Group configuration?

Thu Jul 30, 2009 1:35 pm

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
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7200
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Group configuration?

Thu Jul 30, 2009 1:39 pm

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.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Thu Jul 30, 2009 2:08 pm

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?..
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 27011
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Re: Group configuration?

Thu Jul 30, 2009 2:10 pm

no matter what I do, I can't repeat your problem :)
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8713
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Group configuration?

Thu Jul 30, 2009 2:25 pm

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?..
 
tackerman
newbie
Posts: 29
Joined: Tue Jul 14, 2009 7:37 pm

Re: Group configuration?

Thu Aug 13, 2009 6:47 am

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? . . .
 
tackerman
newbie
Posts: 29
Joined: Tue Jul 14, 2009 7:37 pm

Re: Group configuration?

Thu Aug 13, 2009 7:37 am

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.