mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-03 14:32:24 +02:00
* Catch MonitorException when initialisation failure occurs, print error and exit ... cant enter monitor loop if we cant initialise correctly. * Cleanup and add documentation update
This commit is contained in:
parent
9b3179540f
commit
12947d160f
|
@ -427,6 +427,31 @@ Currently not supported.
|
||||||
### SharePoint / Office 365 Shared Libraries
|
### SharePoint / Office 365 Shared Libraries
|
||||||
Refer to [./Office365.md](Office365.md) for configuration assistance.
|
Refer to [./Office365.md](Office365.md) for configuration assistance.
|
||||||
|
|
||||||
|
## Running 'onedrive' in 'monitor' mode
|
||||||
|
Monitor mode (`--monitor`) allows the onedrive process to continually monitor your local file system for changes to files.
|
||||||
|
|
||||||
|
Two common errors can occur when using monitor mode:
|
||||||
|
* Intialisation failure
|
||||||
|
* Unable to add a new inotify watch
|
||||||
|
|
||||||
|
Both of these errors are local environment issues, where the following system variables need to be increased as the current system values are potentially too low:
|
||||||
|
* `fs.file-max`
|
||||||
|
* `fs.inotify.max_user_watches`
|
||||||
|
|
||||||
|
To determine what these values are on your system use the following commands:
|
||||||
|
```
|
||||||
|
sysctl fs.file-max
|
||||||
|
sysctl fs.inotify.max_user_watches
|
||||||
|
```
|
||||||
|
|
||||||
|
To make a change to these variables:
|
||||||
|
```
|
||||||
|
sudo sysctl fs.file-max=<new_value>
|
||||||
|
sudo sysctl fs.inotify.max_user_watches=<new_value>
|
||||||
|
```
|
||||||
|
|
||||||
|
To make these changes permanent, refer to your OS reference documentation.
|
||||||
|
|
||||||
## Running 'onedrive' as a system service
|
## Running 'onedrive' as a system service
|
||||||
There are two ways that onedrive can be used as a service
|
There are two ways that onedrive can be used as a service
|
||||||
* via init.d
|
* via init.d
|
||||||
|
|
13
src/main.d
13
src/main.d
|
@ -671,8 +671,16 @@ int main(string[] args)
|
||||||
signal(SIGINT, &exitHandler);
|
signal(SIGINT, &exitHandler);
|
||||||
signal(SIGTERM, &exitHandler);
|
signal(SIGTERM, &exitHandler);
|
||||||
|
|
||||||
// initialise the monitor class
|
// attempt to initialise monitor class
|
||||||
if (!cfg.getValueBool("download_only")) m.init(cfg, cfg.getValueLong("verbose") > 0, cfg.getValueBool("skip_symlinks"), cfg.getValueBool("check_nosync"));
|
try {
|
||||||
|
m.init(cfg, cfg.getValueLong("verbose") > 0, cfg.getValueBool("skip_symlinks"), cfg.getValueBool("check_nosync"));
|
||||||
|
} catch (MonitorException e) {
|
||||||
|
// monitor initialisation failed
|
||||||
|
log.error("ERROR: ", e.msg);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cfg.getValueBool("download_only")) {
|
||||||
// monitor loop
|
// monitor loop
|
||||||
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
|
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
|
||||||
immutable auto logInterval = cfg.getValueLong("monitor_log_frequency");
|
immutable auto logInterval = cfg.getValueLong("monitor_log_frequency");
|
||||||
|
@ -740,6 +748,7 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
// Workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
||||||
oneDrive.http.shutdown();
|
oneDrive.http.shutdown();
|
||||||
|
|
Loading…
Reference in a new issue