Page 1 of 2

Update Script?

Posted: Tue 14 Jul 2020 10:21 pm
by Phil23
Can anyone help out with a simple command line script to perform a new files only update.
Usually I just shut MX down after the 10 minute mark & copy them manually.
Sometimes simple, other times a bit more long winded.

What I had in mind is

Code: Select all

Update.bat [Destination Path]
Update \\Weather-PC\CumulusMX
The file list could be pasted into newfiles.txt
Edited as required..

Both files could just be dripped inside the Dist being used.

Code: Select all

\CumulusMX.exe
\Renchi.SshNet.dll
\interface\now.html
\webfiles\js\cumuluscharts.js
It's probably a very simple script, but not one I've created before.

Thanks

Phil.

Re: Update Script?

Posted: Wed 15 Jul 2020 2:50 am
by jlmr731
In general it sounds good, but parsing a file listing of what files were updated then coping them over sounds simple enough, but then that would entail Mark (or someone) to make a say a text file of just updated files, but now a problem can be what if someone skips a release or 2, or maybe if one goes by date modified within zip file would work better but still can lead to problems. Also how to handle the zip file as it is named by build number
I have seen how to upgrade talked about here many times either copy just the updated files listed in the post or update.txt file included in the zip, or just unzip the files into working CumulusMX directory.
So if you wanted a script to automate this my suggestion would be to make a backup of CumlusMX directory then unzip all files to your working MX install

Re: Update Script?

Posted: Wed 15 Jul 2020 5:55 am
by sfws
Phil23 wrote: Tue 14 Jul 2020 10:21 pm Can anyone help out with a simple command line script to perform a new files only update.
Why reinvent the wheel?
There are a number of pieces of software that are described as for the purpose of either to make copying files easier or to make back up easier. Many have command line options and interactive interfaces. Some have FTP capability so can operate with source and destination on different devices, but I am assuming you download and install on same W7 m/c. You might not realise it, but what you are trying to do "update files in one place"( i.e. where you run MX), "from another" (i.e. where you download the zip) is actually an identical task to back up, which really is just copying updated files to another place.

It is a pretty standard function to not overwrite files that are same size and same date. You might prefer the option, "overwrite only if newer", that I tend to use. In the software I use, I also have a verify option ticked, so after the copy the checksum for source and destination files is checked. I would not rely on the list of changed files in the release announcement, that has been known to leave out files, and of course the recent emergency release slipped in some file changes meant to be in next big release. So I don't think your idea of relying on a list of files is a runner.

Recommended software has been named in previous forum posts, and I think there was a topic that talked about free software for backing up about a month or so ago, but why not use a search engine to search copying and back-up software; and pick the one that suits you.

Re: Update Script?

Posted: Wed 15 Jul 2020 6:21 am
by HansR
sfws wrote: Wed 15 Jul 2020 5:55 am Why reinvent the wheel?
Because sometimes it is educational and may bring original solutions (a wheel may be a wrong example here ;) )?
sfws wrote: Wed 15 Jul 2020 5:55 am Recommended software has been named in previous forum posts, and I think there was a topic that talked about free software for backing up about a month or so ago, but why not use a search engine to search copying and back-up software; and pick the one that suits you.
I think Phil is not trying to backup here but trying to update cumulus in an automated manner from the distribution.
But maybe I miss the point.

Re: Update Script?

Posted: Wed 15 Jul 2020 8:51 pm
by Phil23
sfws wrote: Wed 15 Jul 2020 5:55 am but why not use a search engine to search copying and back-up software; and pick the one that suits you.
I do use Search Engines, and I am familiar with copy tools, it's an occupational hazard, to the extent of the days requirements.
When you've been doing stuff since pre Dos 3.0 (exciting release), you learn it's often better to ask than go down your own road....
The Colleague may come back with a very simple answer....

Won't bother trying to list the different tools I've used, no point in attempting a pissing contest,
but all have limitations or complications for the simple task I want to do,
hence just a simple script is all I want. Many people live with complex scripts & for those it would be a snack.

I know others will be doing similar to what I require on other tasks & will be aware of the traps.

Like the simple one that cropped up yesterday.....

Code: Select all

C:\Windows\System32\xcopy.exe ""C:\Windows\System32\winevt\Logs\Microsoft-Windows-Backup.evtx" ""D:\Backups\BackupLog.evtx" /Y
Worked fine for 5 years on a 2008R2 Server, but simply failed to create the destination when run from the same script on a new 2019.

Turned out a simple fix, but did cost some time.
Just a major shortcoming of that particular tool.
HansR wrote: Wed 15 Jul 2020 6:21 am Because sometimes it is educational and may bring original solutions (a wheel may be a wrong example here ;) )?

I think Phil is not trying to backup here but trying to update cumulus in an automated manner
Correct in a sense; not completely automated....

Navigating in and out of various folders can take time, inside the 10 minute window I choose to upgrade.
Then if there's an interruption, things get dropped & need be picked up later... Or left forgotten for hours.

Re: Update Script?

Posted: Thu 16 Jul 2020 3:16 am
by beteljuice
OK ....

It's little bit quirky, but by your command ..
bat.png

Code: Select all

@echo off
echo Copy named files in files.txt
echo[
setlocal enabledelayedexpansion
set /p UserInputPath=What Directory path to copy TO ? 

set "source=.\"
set "target=%UserInputPath%"

for /f "tokens=* usebackq" %%A in (".\files.txt") do (
	set "FILE=%%A"
	set "dest_file_full=%target%\!FILE:%source%=!"
	set "source_file_full=%source%\!FILE:%source%=!"
	echo[
	if not exist "!source_file_full!" (	
		echo Source !source_file_full! NOT found
	) else (
		@xcopy "!source_file_full!" "!dest_file_full!" /s /i /q

		if exist "!dest_file_full!" (
			echo OK !source_file_full! ^> !dest_file_full!
		) else (
			echo FAIL ... !source_file_full! ^> !dest_file_full!
		)
	)
)
echo[
pause
files.txt

Code: Select all

bloodymoon.html*
tits.php*
beteljuiceton\bin_temp\*
releez\stnMon.zip*
As you stipulated, file.txt and whatever.bat reside in the directory being copied from.
Examples show
1/ 'base' file copy
2/ source file doesn't exist
3/ copy of directory and its sub-directories
4/ copy of file in a directory

Quirks (I couldn't be bothered to code around)
files or directories in files.txt to end with * (asterix) (xcopy single file workaround)
No trailing \ (backslash) on end of copy to path (laziness !)

Re: Update Script?

Posted: Thu 16 Jul 2020 5:50 am
by HansR
:lol: Nice ;) That is very, I mean VERY, retro. But working fine I guess...

Re: Update Script?

Posted: Thu 16 Jul 2020 8:10 am
by Phil23
beteljuice wrote: Thu 16 Jul 2020 3:16 am OK ....

It's little bit quirky, but by your command ..
Thanks Betel

Doesn't surprise me you had an answer.
Will give it a try in the office to-morrow.

Can I trouble you once more to attache a copy of the file Tits.php?

Rather intrigued about what it does.

Phil.

Re: Update Script?

Posted: Thu 16 Jul 2020 8:12 am
by Phil23
HansR wrote: Thu 16 Jul 2020 5:50 am Nice ;) That is very, I mean VERY, retro...
Love Retro, it's just fine & light weight at times.

Re: Update Script?

Posted: Thu 16 Jul 2020 8:41 am
by HansR
:lol:

Re: Update Script?

Posted: Thu 16 Jul 2020 5:03 pm
by beteljuice
"retro" ?

... but Hans, you and I were getting confused when it was cutting edge stuff ;)

BTW - the beteljuices confusion with all things coding has not improved much ...

Re: Update Script?

Posted: Thu 16 Jul 2020 5:31 pm
by HansR
beteljuice wrote: Thu 16 Jul 2020 5:03 pm "retro" ?

... but Hans, you and I were getting confused when it was cutting edge stuff ;)

BTW - the beteljuices confusion with all things coding has not improved much ...
:lol: True, but confusion on cutting edge does not mean retro requirement ;)

Re: Update Script?

Posted: Thu 16 Jul 2020 6:04 pm
by mcrossley
Just last week my son told me about a problem he was having at work where their jobs that are pushed to the clients were failing. A quick diagnosis showed their IT department had added a group policy to block PowerShell. I gave him a cmd line script to do exactly what the PowerShell did - 1 liner.

Dredging up memories of the intricacies of "for" and variable expansion parameters was a blast from the past! But it worked and got them out of a hole :lol:

Re: Update Script?

Posted: Thu 16 Jul 2020 7:36 pm
by HansR
old school helps out newbies :? 8-)

Re: Update Script?

Posted: Tue 04 Aug 2020 6:22 am
by Phil23
Finally getting around to my latest update.....

Tried a test run with a copy of the CumulusMX directory on the temp drive of my desktop. (S:)

Shared it as CumulusMX to replicate the Weather PC, where C:\CumulusMX = \\Weather-PC\CumulusMX,
So basically ended up with \\Phils-i7\CumulusMX = S:\CumulusMX.

Placed the script & files.txt in C:\Downloads\CumulusMXDist3089\CumulusMX

One thing I was unsure of is how you specified the destination in the example,
IE F:test2\beteljuice......

No "\" after F:

Anyway I got this result.

Do I need to express the destination a bit differently considering its a full UNC path?

Other thing I assume I could change it so the script & the files txt is in the CumulusMX directory & then specify the source instead of the destination.
Just a matter of changing these two lines?

Code: Select all

set "source=.\"
set "target=%UserInputPath%"
Cheers

Phil.

Code: Select all

C:\Downloads\CumulusMXDist3089\CumulusMX>update
Copy named files in files.txt

What Directory path to copy TO ? \\phils-i7\CumulusMX

File not found - CumulusMX.exe
0 File(s) copied
OK .\\\CumulusMX.exe > \\phils-i7\CumulusMX\\CumulusMX.exe

File not found - dayfileheader.txt
0 File(s) copied
OK .\\\dayfileheader.txt > \\phils-i7\CumulusMX\\dayfileheader.txt

File not found - monthlyfileheader.txt
0 File(s) copied
OK .\\\monthlyfileheader.txt > \\phils-i7\CumulusMX\\monthlyfileheader.txt

Overwrite \\phils-i7\CumulusMX\interface\alarmsettings.html (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\alarmsettings.html > \\phils-i7\CumulusMX\\interface\alarmsetti
ngs.html

Overwrite \\phils-i7\CumulusMX\interface\alltimerecseditor.html (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\alltimerecseditor.html > \\phils-i7\CumulusMX\\interface\alltim
erecseditor.html

Overwrite \\phils-i7\CumulusMX\interface\index.html (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\index.html > \\phils-i7\CumulusMX\\interface\index.html

Overwrite \\phils-i7\CumulusMX\interface\monthlyrecseditor.html (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\monthlyrecseditor.html > \\phils-i7\CumulusMX\\interface\monthl
yrecseditor.html

Overwrite \\phils-i7\CumulusMX\interface\stationsettings.html (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\stationsettings.html > \\phils-i7\CumulusMX\\interface\stations
ettings.html

Overwrite \\phils-i7\CumulusMX\interface\thismonthrecseditor.html (Yes/No/All)?
a
1 File(s) copied
OK .\\\interface\thismonthrecseditor.html > \\phils-i7\CumulusMX\\interface\this
monthrecseditor.html

Overwrite \\phils-i7\CumulusMX\interface\thisyearrecseditor.html (Yes/No/All)? a

1 File(s) copied
OK .\\\interface\thisyearrecseditor.html > \\phils-i7\CumulusMX\\interface\thisy
earrecseditor.html

Overwrite \\phils-i7\CumulusMX\interface\js\alarmsettings.js (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\js\alarmsettings.js > \\phils-i7\CumulusMX\\interface\js\alarms
ettings.js

Overwrite \\phils-i7\CumulusMX\interface\js\alltimerecseditor.js (Yes/No/All)? a

1 File(s) copied
OK .\\\interface\js\alltimerecseditor.js > \\phils-i7\CumulusMX\\interface\js\al
ltimerecseditor.js

Overwrite \\phils-i7\CumulusMX\interface\js\charts.js (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\js\charts.js > \\phils-i7\CumulusMX\\interface\js\charts.js

Overwrite \\phils-i7\CumulusMX\interface\js\dashboard.js (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\js\dashboard.js > \\phils-i7\CumulusMX\\interface\js\dashboard.
js

Overwrite \\phils-i7\CumulusMX\interface\js\datalogs.js (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\js\datalogs.js > \\phils-i7\CumulusMX\\interface\js\datalogs.js


Overwrite \\phils-i7\CumulusMX\interface\js\dayfileeditor.js (Yes/No/All)? a
1 File(s) copied
OK .\\\interface\js\dayfileeditor.js > \\phils-i7\CumulusMX\\interface\js\dayfil
eeditor.js

Overwrite \\phils-i7\CumulusMX\interface\js\monthlyrecseditor.js (Yes/No/All)? a

1 File(s) copied
OK .\\\interface\js\monthlyrecseditor.js > \\phils-i7\CumulusMX\\interface\js\mo
nthlyrecseditor.js

Overwrite \\phils-i7\CumulusMX\interface\js\thismonthrecseditor.js (Yes/No/All)?
 a
1 File(s) copied
OK .\\\interface\js\thismonthrecseditor.js > \\phils-i7\CumulusMX\\interface\js\
thismonthrecseditor.js

Overwrite \\phils-i7\CumulusMX\interface\js\thisyearrecseditor.js (Yes/No/All)?
a
1 File(s) copied
OK .\\\interface\js\thisyearrecseditor.js > \\phils-i7\CumulusMX\\interface\js\t
hisyearrecseditor.js

Overwrite \\phils-i7\CumulusMX\interface\json\CalibrationOptions.json (Yes/No/Al
l)? a
1 File(s) copied
OK .\\\interface\json\CalibrationOptions.json > \\phils-i7\CumulusMX\\interface\
json\CalibrationOptions.json

Overwrite \\phils-i7\CumulusMX\interface\json\CalibrationSchema.json (Yes/No/All
)? a
1 File(s) copied
OK .\\\interface\json\CalibrationSchema.json > \\phils-i7\CumulusMX\\interface\j
son\CalibrationSchema.json

Overwrite \\phils-i7\CumulusMX\interface\json\InternetOptions.json (Yes/No/All)?
 a
1 File(s) copied
OK .\\\interface\json\InternetOptions.json > \\phils-i7\CumulusMX\\interface\jso
n\InternetOptions.json

Overwrite \\phils-i7\CumulusMX\interface\json\InternetSchema.json (Yes/No/All)?
a
1 File(s) copied
OK .\\\interface\json\InternetSchema.json > \\phils-i7\CumulusMX\\interface\json
\InternetSchema.json

Overwrite \\phils-i7\CumulusMX\webfiles\js\cumuluscharts.js (Yes/No/All)? a
1 File(s) copied
OK .\\\webfiles\js\cumuluscharts.js > \\phils-i7\CumulusMX\\webfiles\js\cumulusc
harts.js

Source .\\.\= NOT found

Press any key to continue . . .

C:\Downloads\CumulusMXDist3089\CumulusMX>