Community discussions

MikroTik App
 
sskillin
just joined
Topic Author
Posts: 13
Joined: Tue Jan 06, 2009 10:05 pm

help creating auto update scripts

Mon Aug 09, 2010 4:26 am

Hello,
We have several devices that may or may not be on at a given time. I'd like to write a script that will fetch any new updates that we'd like to make, with some reporting and basic error recovery in place. sometimes a device may have missed a previous update, so I'd like to be able to assure that all devices get all updates when they do come online. We will write a new .auto.rsc file for each change we'd like to implement, which could be anything from changing NTP servers to doing full code upgrades. Also, I'd like to be sure a device doesn't repeatedly try to apply the same update over and over again - if it succeeded in doing the update once, it shouldn't need to try again every hour/day/startup just because the file exists.

Here's what I'm trying to accomplish. any help is greatly appreciated, or any better ideas of course :)

files on ftp site named like: UPDATE2010081201.auto.rsc #first change file for Aug 12, 2010
#each update file will be written to the local device as well as executed - maybe there's a better way to track successful updates?

#if it's 3PM or if we just booted, we should run
#check that we have good connection to ftp server; if not then write timestamp & CONNECT FAIL to local log file and exit
#if any local files aren't on server any more, remove them from the device. write each action to local log file
#if any new files on server that I don't have, copy them to me and process their contents. write each action to local log file
#write to local log file the status of checkin (nothing new but I tried, I processed this file, etc)
#send contents of the local log file to central log server via syslog (one message per line?)
#clear local log file
#retry every hour until successful, then go back to every 24 hour|on startup schedule
##if CONNECT FAIL exists in local log, we should run hourly

Thanks!!
Shaun
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: help creating auto update scripts

Mon Aug 09, 2010 6:22 am

Search the wiki for auto upgrade scripts, they should help you get started.
 
sskillin
just joined
Topic Author
Posts: 13
Joined: Tue Jan 06, 2009 10:05 pm

Re: help creating auto update scripts

Sun Aug 15, 2010 6:45 pm

I've been looking through the posts, and here's where I'm getting stuck... I'd like to create a scheduled task that "checks in" periodically for any new information, or that will run any new commands. Let's say one time I want to increase logging for a while, so I put these commands into a .auto.rsc file. If the radio checks in and sees a .auto.rsc file that it hasn't run yet, it should run it. If it has already run the file, it should ignore it. I'd also like to get some feedback as to which radio has checked in, whether it ran anything, and the result after running it, if possible.
The scheduling part seems straight-forward, it's the error checking that's throwing me off a little (has it already run this file). any ideas there?
Thanks!

Who is online

Users browsing this forum: Alexhatake and 16 guests