mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-21 15:16:36 +02:00
Detect if application is already operational (#1944)
* In some scenarios users may have a running background service syncing data (systemd or otherwise). In these events, running the application in standalone mode can create a conflict when attempting to perform database queries when there are significant changes to data structures occurring. This PR specifically checks if the database operation files are present, and, if these are present (meaning the application is most likely currently operational) fail fast and not execute the application as a second instance against the same active configuration. Potentially also resolves RBZ2061430 and RBZ2075468
This commit is contained in:
parent
10448efd9a
commit
5506efb313
11
src/main.d
11
src/main.d
|
@ -163,6 +163,17 @@ int main(string[] args)
|
||||||
// update configuration from command line args
|
// update configuration from command line args
|
||||||
cfg.update_from_args(args);
|
cfg.update_from_args(args);
|
||||||
|
|
||||||
|
// In some cases, a user may have a systemd service running, and, also attempt a manual sync
|
||||||
|
// This causes issues with DB items / DB entries if there are significant changes in the database
|
||||||
|
// Check to see if 'items.sqlite3-shm' and 'items.sqlite3-wal' are present - if they are present, we need to exit early
|
||||||
|
string activeShmFile = cfg.databaseFilePath ~ "-shm";
|
||||||
|
string activeWalFile = cfg.databaseFilePath ~ "-wal";
|
||||||
|
if (exists(asNormalizedPath(activeShmFile)) || exists(asNormalizedPath(activeWalFile))) {
|
||||||
|
log.error("ERROR: onedrive application is already running - check system process list for active application instances");
|
||||||
|
log.vlog(" - Use 'sudo ps aufxw | grep onedrive' to potentially determine acive running process");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// --resync should be a 'last resort item' .. the user needs to 'accept' to proceed
|
// --resync should be a 'last resort item' .. the user needs to 'accept' to proceed
|
||||||
if (cfg.getValueBool("resync")) {
|
if (cfg.getValueBool("resync")) {
|
||||||
// what is the risk acceptance?
|
// what is the risk acceptance?
|
||||||
|
|
Loading…
Reference in a new issue