Feature Request: When finished: Show Log

Discuss new features and functions
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

Not sure if it was previously requested.

.... but using FFS mainly as a batch, kicked up by TaskSched....

I would really appreciate to have this feature, instead of having to remember to check every day my logs.

Thanks

Alain
You do not have the required permissions to view the files attached to this post.
therube
Posts: 146
Joined: 8 May 2006

Post by therube

Create a couple batch files that run SHUTDOWN.EXE (with appropriate parameters) ?
Call one, Sleep.bat.
The other, Shut down.bat.

(I'm not sure if Shutdown offers a sleep option?)


Oh, you're wanting, Show Log.

(I'm not thinking right but) something like...

showlog.bat:
cat `dir /od- /b [path-to-log-directory] | head -1`
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

Thanks !!!
not clear how to "call" the bat file...


I'll try and report back

Alain
toby9999
Posts: 10
Joined: 20 Jul 2020

Post by toby9999

The FFS help file has some info on calling batch files.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

The FFS help file has some info on calling batch files. toby9999, 23 Jul 2020, 05:04
My FFS.Batch file is run by taskmanager.
.
... no idea how to run your command...
and if it's in a .bat file,

how to chain it at the end of FF.batch in taskmanager.

Alain
toby9999
Posts: 10
Joined: 20 Jul 2020

Post by toby9999

So, are you trying to run a batch file (to show the FFS log file) after the FFS batch runs?

1) Tasksched -> FreeFileSync.exe "yourScript.ffs_batch"
2) Make sure yourScript.ffs_batch contains a completion job...
eg <PostSyncCommand Condition="Completion">"C:\LogHandler.bat"</PostSyncCommand>
3) The LogHandler batch file will run and do whatever you want after each successful completion of yourScript.ffs_batch

Is that what you're trying to do, or something different?
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

Perfect!!

A) New/Edit PostLog.bat
Add one line = "cat `dir /od- /b [......\...\F8-log-directory] | head -1`"

B) edit the FFS.batch:
Add one line = "PostSyncCommand Condition="Completion">"...\PostLog.bat"


Nothing else to change.

Correct??

Many Thanks

Alain

PS: all this is on the root of a USB Key stuck in the back,
as a permanent backup for my Thunderbird mail,
and it will run three times a day
You do not have the required permissions to view the files attached to this post.
toby9999
Posts: 10
Joined: 20 Jul 2020

Post by toby9999

Looks good, but don't forget to add </PostSyncCommand> at the end of the PostSyncCommand line.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

oooh...
forgot that

thanks!!

Alain
You do not have the required permissions to view the files attached to this post.
User avatar
Plerry
Posts: 1027
Joined: 22 Aug 2012

Post by Plerry

For correct XML, your line should read:
<PostSyncCommand Condition="Completion">Postlog.bat</PostSyncCommand>
possibly providing the correct path to Postlog.bat.
For convenience you may consider to use the FFS GUI instead of a text editor.
If in the Sync Settings (F8) you define the correct command line (e.g. Postlog.bat), and then save the FFS configuration (as a *.ffs_gui or *.ffs_batch file), FFS willl do the work for you and generate the correct XML code.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

Oh Wow your are so kind !!

So I deleted the line. Saved FFS.Batch file

did "FFS edit" F8 ... then saved it
opened with notepad an LO!

My problem is solved!!!!!

a big thanks

(unless I did something wrong into the PostLog.bat file)
You do not have the required permissions to view the files attached to this post.
therube
Posts: 146
Joined: 8 May 2006

Post by therube

(I'm not thinking right but) something like...
I'm on Windows, & when I said "like", I meant like ;-).
As in what I wrote was a mixture of DOS & Unix commands (& syntax's).

So the PostLog.bat that you came up with actually does work?
And just what command line are you using in there?
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

ooops
I took it literally

and thinking back I've never seen the log appearing :-D

No, that .bat string doesn't work.

:-D

Alain
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

Any help on the PostLog.bat will be gratefully received !!!

Alain
therube
Posts: 146
Joined: 8 May 2006

Post by therube

(For Windows.)
Try this, adjusting as needed.

PostLog.bat:
for /f "delims=|"  %%i in  ('dir /b  C:\LOGS\FFS_LOGS\')  do  set LASTLOG=%%~fi
echo The last log is:  %LASTLOG%
pause

notepad.exe "%LASTLOG%"
Set your directory to wherever you have your FFS logs directory set to.
LASTLOG will store the full path+name of the last file name (so presumably the newest) as generated by a dir /b file listing, as found in your log directory.
(After the pause) notepad.exe will open the log file.
(Change notepad.exe to whatever you want; vim.exe, less.exe, showtx.exe ...)

Beware of diacritics in your (log) filename because not all utilities will handle diacritics correctly (like Ú vs U).


(You can run PostLog.bat directly to see what it can do, if it's working correctly - so no need, necessarily, to run FFS first.)
Last edited by therube on 26 Jul 2020, 21:57, edited 2 times in total.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

ok thanks
I'll change the Log dir and that's all I suppose.

everything is under K: root ... and K is a portable USB stick.

in pic 2 the results


Many thanks

Alain
You do not have the required permissions to view the files attached to this post.
therube
Posts: 146
Joined: 8 May 2006

Post by therube

(I made some slight changes to PostLog.bat, above.)

In your case, you may want to change it again, something like, ('dir /b k:\nis*.html'')


(As it is, for you, it is finding "NIS-BKP 2", which would be the wrong file.)
Last edited by therube on 26 Jul 2020, 22:00, edited 1 time in total.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

here's the new run.

with error after pause

Thanks
You do not have the required permissions to view the files attached to this post.
therube
Posts: 146
Joined: 8 May 2006

Post by therube

In your case, you may want to change it again, something like, ('dir /b k:\nis*.html'')


(As it is, for you, it is finding "NIS-BKP 2", which would be the wrong file [directory].)


When correct it should presumably display *194512*.html.
(Heh. But then, notepad won't help too much with .html, so maybe you'll want something like:
edge.exe "%LASTLOG%")
Last edited by therube on 26 Jul 2020, 22:05, edited 1 time in total.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

correct.
doing

Success !!!

a Great thanks !!
You do not have the required permissions to view the files attached to this post.
AlainCh2
Posts: 26
Joined: 29 May 2019

Post by AlainCh2

better this way

it's an HTML it open in browser directly

You are Wonderfull !

Alain
You do not have the required permissions to view the files attached to this post.