i have two home servers, both running windows free hyper-v server.
one is a file and media server and one is a backup server.
on that backup server, i have free edition of veeam backup and replication, instant recovery and all the good stuff.
So, what should the "finished product" look like?
Is this the part of the code, with the issue?
:: Now let us sync. This makes a mirror of sourcepath to destpath (including removing files if required), and any files that get "overwritten" or "deleted" as a
:: result from destpath, will be moved into archive and and timestamped instead - effectively creating a full archive of all revisions of files you have ever had.
%rclonepath%\rclone sync "%sourcepath%" "%destpath%" --backup-dir="%archivepath%%currentDate%---%currentTime%" --fast-list -P --drive-chunk-size 64M --log-file="%logfile%" --log-level="%loglevel%"
echo:
yes, veeam can do bare metal restore and inject new hardware drivers. i have used acronis for many years and it is great at bare metal recovery. again, as i do not use vmware, you should do some research and testing.
vmware should have some kind of backup for the server itself, configuration and so on.
virtual machines are just files, that can be copied, with any file manager or command line.
I will see if I can update the code today to fix the points mentioned by asdffdsa.
If you have any problems using that as-is then I suggest you just ask.
It should just involve changing the -settings- part of the script. If I have overlooked anything just point it out. Better that we fix it in the posted script (so it can be more robust and useful to others) than you having to finagle it yourself to get it to work.
@Charles_Hayes Take a look there (up in the earlier post)
I updated the previous post to have the new script 1.1 in it. It should fix all the issues mentioned by asdfdsa earlier. If I missed anything, let me know.
Do note that you should NOT need to mount the drive to run this. That will only make this run slower actually.
I figure you maybe misunderstood that 2 of the settings actually expect the name of your rclone remote.
I made that more explicit in my examples, so check that again. If that doesn't make it clear then I suggest you just ask. If it's not understandable to you then we just need to document it even better
Missing logfile name: Fixed. Logfile is now set to date+time.log
New variable for flags: added to settings.
Date format: Changed (reversed) to yyyy.mm.dd
+various minor simplifications and cleanup to make it more readable.
to run rclone.exe from a batch file and use --progress, you need start /w rclone.exe else you will get an error in the log file.
the exit code is always 0
perhaps
if %ERRORLEVEL% equ 0 (
echo Sync completed sucessfully!
exit /b 0
) else (
echo rclone reported an error during the sync
exit /b 1
)
this is how i calculate date and time
for /f "usebackq skip=1 tokens=1-6" %%g in (wmic Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year ^| findstr /r /v "^$") do (
set day=00%%g
set hours=00%%h
set minutes=00%%i
set month=00%%j
set seconds=00%%k
set year=%%l
)
set month=%month:~-2%
set day=%day:~-2%
set hh=%hours:~-2%
set mm=%minutes:~-2%
set ss=%seconds:~-2%
set date=%year%%month%%day%_%hh%%mm%%s%
You sure? No errors in my logfiles here. Not sure I see why running it directly in the script would be an issue. Can you elaborate on what error might occur?
Sure, that's easy enough to add. I didn't really focus on having proper errorcodes here since it's probably not something the OP would use, but I agree it should be added for completeness in case someone wanted to call it from another script. I will fix. EDIT: fixed 1.2 - replaced old code in original post.
That's nice and clean ,but do you see any reason to change it from what it is currently? I believe the current code should yield correct results. Didn't really see the need to split it up any further in this case, even though that would probably render it more customizable.
The timestamp format right now is yyyy.mm.dd_hh.mm
If you get something so radically different hmm... is it because you use some other locale format in Windows? Mine certainly doesn't have any "name of week-day" in it. Does that reflect what is given by %time% ? If so this is not something I thought about... I assumed %time% was a fixed format. If this is a problem I probably have to find a way to source this more reliably.
EDIT: if you are reasonably sure your source does not share the same issue I will just use that instead.
EDiT2: Ok yea, this is a local problem it seems. From Stackoverflow: The %date% will give different string with different locale. – [AechoLiu](https://stackoverflow.com/users/419348/aecholiu) Nov 12 '13 at 9:04
Ah, cool. That explains it. I was getting very confused because my logs worked fine and had the -P output in them without any errors.
I have read up on WMI and %date% timelocal problems. I now see that your solution is clearly more robust - so I've just replaced that datecalculation with yours. I've just never noticed I guess because I usually only make batchscripts for myself, but I will use this from now on myself. Thanks for learning me something useful