Updating DB via scheduled task doesn't work with a certain setting
Updating DB via scheduled task doesn't work with a certain setting
What I want to do is to have Everything update the DB at a certain frequency so that I can backup it. Sounds simple - just create a task and slap -update -startup on it, except there's a problem: If I choose "Run whether user is logged in or not" or set the user to System, then the task simply does nothing - it displays a non-zero exit code and the DB doesn't get updated. (Also, the process that Everything creates doesn't get closed by itself.) (I could choose "Run only when the user is logged in" (the default) in task properties, but then the console window pops up, which I don't like (DB updates properly in this case, though).)
(I'm on Win 7, in case it matters)
(I'm on Win 7, in case it matters)
Re: DB doesn't get properly updated via scheduled task
Please make sure debug mode is off in your Everything ini:the console window pops up
- In Everything, type in the following search and press ENTER:
/debug=0 - In Everything, from the File menu, click Exit
Please make sure you set the task to use the same user that normally runs Everything.
If you run as SYSTEM, Everything will use the wrong settings and your database will end up c:\users\administrator\appdata\local\everything
Please try the following command:
Everything.exe -update -startup -exit
the -exit option will force Everything to exit after updating your database on disk.
Re: Updating DB via scheduled task doesn't work with a certain setting
Ah, sorry for being unclear: I meant that Windows' console pops up due to the commands being in a .bat file, it's not related to the debug settings.
...Except there is one further complication. I have one drive unplugged and its contents are still indexed by Everything. If I run the .bat file manually, this drive gets included in the resulting DB, as I would expect. However, when running this exact .bat as a task, this drive doesn't get included; however, this happens _only_ if the task is set to "Run whether user is logged in or not"; if it's the default "Run only when the user is logged in", it works just as when running the .bat file manually, i.e. the missing drive is included. (I noticed that the two methods gave a notably different sizes of the DB and then I used the db2efu utility to determine what exactly was the cause)
What might be causing this?
Oh, thanks for pointing this out. I double-checked and it turns out that my initial post wasn't completely correct - only running as SYSTEM fails to update the DB; running as myself with "run whether user is logged in or not" updates it correctly and with no console pop-up, which is exactly what I want.If you run as SYSTEM, Everything will use the wrong settings and your database will end up c:\users\administrator\appdata\local\everything
...Except there is one further complication. I have one drive unplugged and its contents are still indexed by Everything. If I run the .bat file manually, this drive gets included in the resulting DB, as I would expect. However, when running this exact .bat as a task, this drive doesn't get included; however, this happens _only_ if the task is set to "Run whether user is logged in or not"; if it's the default "Run only when the user is logged in", it works just as when running the .bat file manually, i.e. the missing drive is included. (I noticed that the two methods gave a notably different sizes of the DB and then I used the db2efu utility to determine what exactly was the cause)
What might be causing this?
Re: Updating DB via scheduled task doesn't work with a certain setting
I couldn't get a bat to run when using 'Run whether user is logged in or not' and when using a standard user account.
Using an admin account worked fine. However, that will run Everything in another user profile with different settings.
Are you using the same logged in user account for your task?
How are you indexing the external drive? is it just a folder index under Tools -> Options -> Folders?
https://stackoverflow.com/questions/25752296/task-scheduler-cannot-open-batch-file-when-set-to-run-whether-user-is-logged-on
Using an admin account worked fine. However, that will run Everything in another user profile with different settings.
Are you using the same logged in user account for your task?
How are you indexing the external drive? is it just a folder index under Tools -> Options -> Folders?
https://stackoverflow.com/questions/25752296/task-scheduler-cannot-open-batch-file-when-set-to-run-whether-user-is-logged-on
Re: Updating DB via scheduled task doesn't work with a certain setting
Yes, my account has admin privileges.Are you using the same logged in user account for your task?
No; it is an internal drive, and it is indexed using Options → NTFS like the other volumes. (though it is listed as being offline, of course)How are you indexing the external drive? is it just a folder index under Tools -> Options -> Folders?
Re: Updating DB via scheduled task doesn't work with a certain setting
You need logon as a batch job rights for that. A standard user account does not have this right. You can add that right through local or global policies.
In the past (XP-era) there was a command-line tool for that, but can't find it anymore (probably no longer part of Windows).
Re: Updating DB via scheduled task doesn't work with a certain setting
Please try disabling automatically remove offline volumes (you may have done this already):No; it is an internal drive, and it is indexed using Options → NTFS like the other volumes. (though it is listed as being offline, of course)
- In Everything, from the Tools menu, click Options.
- Click the NTFS tab on the left.
- Uncheck Automatically index new fixed volumes.
- Uncheck Automatically index new removable volumes.
- Uncheck Automatically remove offline volumes.
- Click OK.
Re: Updating DB via scheduled task doesn't work with a certain setting
It is unchecked. Just to reiterate - I _can_ search through this drive via Everything and it correctly gets included in the DB when I run "Everything.exe -update -startup" either manually or via the task with "Run only when the user is logged in" setting; it is _only_ when I do that via the task with "Run whether user is logged in or not" that this drive doesn't get included.
Re: Updating DB via scheduled task doesn't work with a certain setting
And... it broke again. Trying to run a bat with only the following content:
"C:\program files\everything\Everything.exe" -update -startup
as myself, with admin privileges, via a "Run whether user is logged in or not" task, did not update the DB at all, even though the task scheduler listed the task as finishing with 0 exit code, and even though this exact sequence of actions has previously given me a different result (it updated the DB with a missing drive). Oof.
("C:\program files\everything\Everything.exe" -update -startup -exit -debuglog gives the same result; running the bat manually or executing the task with "Run only when the user is logged in" setting makes everything work correctly)
Here is the content of the debug log:
Though actually you know, I think I've taken up enough of your time on such a small problem; after searching around, I found a utility called "Nircmd" that has done what I want (allowed me to run the task with "Run only when the user is logged in" setting without showing the console), so now everything works to my satisfaction. I do think that there is some problem with Everything's handling of tasks with "Run whether user is logged in or not" setting, but I don't know how important it is for you to identify and fix it. (I can stick around and help with the debugging if you want, though.) Thanks for bearing with me.
"C:\program files\everything\Everything.exe" -update -startup
as myself, with admin privileges, via a "Run whether user is logged in or not" task, did not update the DB at all, even though the task scheduler listed the task as finishing with 0 exit code, and even though this exact sequence of actions has previously given me a different result (it updated the DB with a missing drive). Oof.
("C:\program files\everything\Everything.exe" -update -startup -exit -debuglog gives the same result; running the bat manually or executing the task with "Run only when the user is logged in" setting makes everything work correctly)
Here is the content of the debug log:
Code: Select all
2021-05-25 00:01:20.161: Everything
2021-05-25 00:01:20.167: Version 1.4.1.935 (x64)
2021-05-25 00:01:20.223: Windows NT 6.1
2021-05-25 00:01:20.279: Processors 12
2021-05-25 00:01:20.335: IsAdmin 1
2021-05-25 00:01:20.390: AppData 1
2021-05-25 00:01:20.446: Service 2
2021-05-25 00:01:20.503: cmdline "C:\program files\everything\Everything.exe" -update -startup -exit -debuglog
2021-05-25 00:01:20.559: load localization
2021-05-25 00:01:20.615: lng file opened!
2021-05-25 00:01:20.671: header size 865
2021-05-25 00:01:20.727: version 1
2021-05-25 00:01:20.783: got header
2021-05-25 00:01:20.838: system default lid 0409
2021-05-25 00:01:20.893: count 37
2021-05-25 00:01:20.948: ole initialize: 00000000
2021-05-25 00:01:21.003: create mutex
2021-05-25 00:01:51.160: mutex exists
2021-05-25 00:01:51.165: shutdown
2021-05-25 00:01:51.217: kill
2021-05-25 00:01:51.270: event start 0000000000000000
Last edited by Dariush on Mon May 24, 2021 9:26 pm, edited 1 time in total.
Re: Updating DB via scheduled task doesn't work with a certain setting
Thanks for the debug log.
Is this expected?
Otherwise, Everything will continue to run in the background.
"C:\program files\everything\Everything.exe" -update -startup -exit
Please make sure Everything is installed correctly:
Everything is already running.2021-05-25 00:01:51.160: mutex exists
Is this expected?
Don't forget the -exit"C:\program files\everything\Everything.exe" -update -startup
Otherwise, Everything will continue to run in the background.
"C:\program files\everything\Everything.exe" -update -startup -exit
Everything is set to run as an admin and the Service is installed and not running.2021-05-25 00:01:20.335: IsAdmin 1
2021-05-25 00:01:20.390: AppData 1
2021-05-25 00:01:20.446: Service 2
Please make sure Everything is installed correctly:
- In Everything, from the Tools menu, click Options.
- Click the General tab on the left.
- Check Store settings and data in %APPDATA%\Everything.
- Uncheck Run as administrator.
- Check Everything Service. (Please make sure this is tick-checked and not square-checked)
- Click OK.
- Exit Everything(right click the Everything tray icon and click Exit).
- Restart Everything.
Re: Updating DB via scheduled task doesn't work with a certain setting
Hmm. Okay, so here's what happened:
First, I tried launching the task (with -exit -debuglog) when Everything is running normally. I got a log identical to the one provided above, DB didn't get refreshed. I exited Everything via File → Exit, then killed a stray Everything.exe process (specifically "Everything.exe -update -startup"), retried running the task with "Run whether user is logged in or not" and the DB got refreshed correctly, in full.
At this point the only Everything process running is "Everything.exe -svc".
Then, I recreated the previous, standard conditions (meaning I have "Everything.exe -update -startup", "Everything.exe" and "Everything.exe -svc" running) and tried running the task again (again with the "Run whether user is logged in or not" setting, meaning that the past conditions are recreated exactly) and the DB got refreshed correctly again. I checked the debug log and there after the "create mutex" line it immediately follows with normal stuff ("sys img list 00000000003c38b0 00000000003c0000 1 0" and then 1000 more lines) instead of waiting for 30 seconds and dying with "mutex exists".
So basically, now I can't replicate not only the problematic state where the DB got refreshed sans one drive, but also the other problematic state where the DB didn't get refreshed at all.
First, I tried launching the task (with -exit -debuglog) when Everything is running normally. I got a log identical to the one provided above, DB didn't get refreshed. I exited Everything via File → Exit, then killed a stray Everything.exe process (specifically "Everything.exe -update -startup"), retried running the task with "Run whether user is logged in or not" and the DB got refreshed correctly, in full.
At this point the only Everything process running is "Everything.exe -svc".
Then, I recreated the previous, standard conditions (meaning I have "Everything.exe -update -startup", "Everything.exe" and "Everything.exe -svc" running) and tried running the task again (again with the "Run whether user is logged in or not" setting, meaning that the past conditions are recreated exactly) and the DB got refreshed correctly again. I checked the debug log and there after the "create mutex" line it immediately follows with normal stuff ("sys img list 00000000003c38b0 00000000003c0000 1 0" and then 1000 more lines) instead of waiting for 30 seconds and dying with "mutex exists".
So basically, now I can't replicate not only the problematic state where the DB got refreshed sans one drive, but also the other problematic state where the DB didn't get refreshed at all.