Add an option to tell everything.exe to re-index nightly

Have a suggestion for "Everything"? Please post it here.
Post Reply
Slappy
Posts: 2
Joined: Tue Apr 09, 2013 11:04 pm

Add an option to tell everything.exe to re-index nightly

Post by Slappy »

I don't use monitor changes because
A) I don't want the overhead as thousands of files get changed each time I start a build
B) I don't trust it, I've noticed it has missed files in the past

I do love everything.exe though and can't really live without it. I want to use it like I use "locate" on unix systems, with a nightly refresh.

Currently I have the following batch file:
| taskkill /im everything.exe /f
| del "c:\Program Files (x86)\Everything\Everything.db"
| run "c:\Program Files (x86)\Everything\Everything.exe" -startup

which I keep on my desktop and use any time I want the db updated. I also have it scheduled to be run nightly but sadly it doesn't work and leaves everything.exe not running.

So please add a command line flag such as "-reindex" or allow direct setting of when to reindex in the app directly (it's important it's done when the machine is idle).

Thanks for a wonderful tool.
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

I have added the -reindex command option for the next beta release of Everything.

Thanks for the suggestion.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

I've found that when running Everything as a service that the index is never updated, despite the check box being checked that's supposed to do that.

So I figured, no problem, I could stop the service at night, run -reindex, and then start the service. The problem is that -reindex runs the program to do its work. The time it takes to reindex is unpredictable. I suppose I could allow it an hour, kill Everything, and then run the service. That should work but is pretty sloppy.

I then was inspired by the OP: stop the service, delete the db, then run the service. That's cleaner. Unfortunately, when you run Everything as a service, it doesn't create the index (it has to exist beforehand).

So, is there a better way of going about it than I've come up with?

Thanks
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

OK, so I tried that, but killing Everything prevents it from writing the db, so that's out.

So what I'm trying to do is have Everything exit elegantly after the -index so that the db is written out. Is there a way to index and exit? Or at least make the index write out the db?

I tried running the -exit command later in the batch, but the command is never executed.
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

I tried running the -exit command later in the batch, but the command is never executed.
Fixed for the next update.
For now, please run a batch file:
reindex.bat

Code: Select all

Everything.exe -reindex
Everything.exe -exit
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

Thanks. That's what I've tried, however.

The second line doesn't run because the program never exits. The batch must interpret that as the first command still executing.
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

Sorry, I completely misread your post, can you confirm Everything doesn't exit after the indexing is complete?

What version of Everything are you using?

Could you please post some debug output by running from a command prompt:
Everything.exe -debug -reindex
Everything.exe -debug -exit


What is displayed in the debug console?
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

OK, I did that, and sent the results to the email mentioned in that other post, but I think this is a batch file issue and not a problem with your program (and it's not even related to indexing).

Since the batch is sequential, it will wait forever, if necessary, for the first command to complete. Since Everything is still running after the indexing finishes, it's never considered complete. The batch file can't know when the indexing is complete.

I could be completely wrong, but that's what it seems like to me.
therube
Posts: 4614
Joined: Thu Sep 03, 2009 6:48 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by therube »

-reindex opens the GUI (which I would not have particularly expected).

And it appears that is does not do anything like send a Quit when it finishes.

So the GUI remains.

At that point I'm thinking, well there is no way the -exit line will run until the GUI Quits.
So that kind of kills the batch file idea.

But then its sitting there open, & it's like, duh!
I can send an -exit & it will close the GUI.
So from a command line I send the -exit & it closes.

Then I think, well all you need to do is to have the first batch file run the -reindex, & when its done, call the second batch file - which runs the -exit, & problem solved.

But then I realized that the "when its done, call the second batch file" won't work for the very same reason as the initial (single) batch file method wouldn't work, duh again!


You could fire -reindex asynchronously, perform a WAIT for a period of time, then fire -exit.
Not really clean, but if you waited long enough it would work.

The .db doesn't get locked or anything like so you couldn't check for a lock & wait for that to drop to run the -exit. (And the .db doesn't actually update until you Quit the GUI, aka -exit, in any case.)


And got to assume that a GUI Force Rebuild actually is running a -reindex.


So maybe change -reindex so that if called from a command line or batch file, it either does not load the GUI, or it automatically exits the GUI on completion. And if -reindex is called from within the GUI, it does as it does currently, reindexes & remains running.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

We had amazingly similar trains of thought on this.

To start with the end, yes, for -reindex one of those two things would be ideal. I think the "Force rebuild" from within the GUI, while accomplishing the same thing, is doing it in a different way since no DOS box is invoked.

I actually had tried a second task (and batch) for the -exit before (in reference to the asynchronous part you're talking about), timed to execute after I knew the reindex was finished, but I don't think it worked. Still, I'll try it again, as I'm not sure now having tried so many permutations.
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

Thanks for the debug output.
I forgot the START command, sorry.
Also I found an issue with Everything not processing the second command, I have added this to my "things to fix" list.
The timeout command fixes this issue (for Vista or later, for XP, replace timeout with ping 1.1.1.1 -n 1)
The -startup option suppresses any UI windows.
The -update and -exit command forces Everything to wait for the reindex and saves the database to disk before exiting.

Please try the following batch file:

Code: Select all

START everything.exe -reindex -startup
timeout /t 1
START everything.exe -update -exit -startup
Note: timeout requires Windows Vista or later.
therube
Posts: 4614
Joined: Thu Sep 03, 2009 6:48 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by therube »

That looks to get it.

So the keys are to use START (allowing the commands to be sent to Everything asynchronously) & then the -update, which knows it has to wait for the reindex to complete (& also doesn't allow -exit to run until it has done so).

(And I guess the real key is the -update, which waits, cause all else could be worked around rather easily.)
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

Thanks all, it looks like it's working now.

I wish I'd noticed that -update switch before, but somehow I missed it. Still, even if I had, I doubt that I would have combined it with START, which is very subtle and not often needed in batch files.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

Hi. I noticed "improved -update -exit" in the beta release notes, which probably fixes the items you had mentioned above.

What does this mean now for the best way to do an automated reindex? Are the two separate everything lines still needed, or is it better done with one?
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

What does this mean now for the best way to do an automated reindex?
Are the two separate everything lines still needed, or is it better done with one?
In Everything 1.4 only the one command is needed now:

Code: Select all

Everything.exe -reindex -exit
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

OK, got it.

Is -reindex supposed to handle folder indexing though? I tried running the above command on a system with only folder indexing, and Everything exits in a couple seconds, seemingly doing nothing more than refreshing the timestamp on the .db file. It would take much longer than that if really reindexing folders, which are online at the time.
void
Developer
Posts: 15395
Joined: Fri Oct 16, 2009 11:31 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by void »

Is -reindex supposed to handle folder indexing though?
Everything should completely rescan the folder indexes.
It seems to be working as indented for me.
If this information is cached by Windows, it will only take a few seconds to rescan.

While Everything is not running, try making a folder eg: foobar and see if it shows up in the index after a -reindex.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Add an option to tell everything.exe to re-index nightly

Post by rseiler »

void wrote:If this information is cached by Windows, it will only take a few seconds to rescan.

While Everything is not running, try making a folder eg: foobar and see if it shows up in the index after a -reindex.
It does, so that must have been it! That never would have occurred to me.
Post Reply