diff --git a/gmetad-python/gmetad.py b/gmetad-python/gmetad.py index d5c142c..57c0a0d 100755 --- a/gmetad-python/gmetad.py +++ b/gmetad-python/gmetad.py @@ -175,10 +175,6 @@ if __name__ == '__main__': ignore_fds.append(fileHandler.stream.fileno()) logging.getLogger().addHandler(fileHandler) - # Switch to non-priviledged user if running as root - if not os.getuid(): - setuid() - # Determine if the service should be daemonized based on the debug level. if 5 > int(gmetadConfig[GmetadConfig.DEBUG_LEVEL]): daemonize(ignore_fds) @@ -198,6 +194,10 @@ if __name__ == '__main__': logging.error('Unable to write PID %d to %s (%s)' % (os.getpid(), gmetadConfig[GmetadConfig.PIDFILE], e)) sys.exit() + # Switch to non-priviledged user if running as root + if not os.getuid(): + setuid() + # Initialize the data store with the notifier and summery threads and plugins dataStore = DataStore()