diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-07-15 15:31:37 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-07-15 15:31:37 +0300 |
commit | 2588e21989b40c13fe14a67074f35c62efab49c8 (patch) | |
tree | 8fe63a47d0740e4b758804fff64c4b4107b0bdcb /src/main.c | |
parent | 2b7552ad06c41bfbb1eed74cb081b07a19d64464 (diff) |
netdata sets the PATH for its plugins
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 16c34c7214..d79bf668a6 100644 --- a/src/main.c +++ b/src/main.c @@ -444,6 +444,13 @@ int main(int argc, char **argv) // http://stackoverflow.com/questions/4554271/how-to-avoid-excessive-stat-etc-localtime-calls-in-strftime-on-linux setenv("TZ", ":/etc/localtime", 0); + { + char path[1024 + 1], *p = getenv("PATH"); + if(!p) p = "/bin:/usr/bin"; + snprintfz(path, 1024, "%s:%s", p, "/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); + setenv("PATH", config_get("plugins", "PATH environment variable", path), 1); + } + // cd to /tmp to avoid any plugins writing files at random places if(chdir("/tmp")) error("netdata: ERROR: Cannot cd to /tmp"); |