summaryrefslogtreecommitdiffstats
path: root/tuned
diff options
context:
space:
mode:
authorPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-23 18:03:35 +0100
committerPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-23 18:03:35 +0100
commit80093be74fbed8d4459938e19ff00920a41a9712 (patch)
treec73b82af32e34b7a74bdfd4ca96c4ff3f6cd2465 /tuned
parentc02f25afb09ff1f38484a8b69c4dcc85ed2378c7 (diff)
downloadtuned-80093be74fbed8d4459938e19ff00920a41a9712.tar.gz
tuned-80093be74fbed8d4459938e19ff00920a41a9712.tar.xz
tuned-80093be74fbed8d4459938e19ff00920a41a9712.zip
- Real first complete version with initscript, config file and
proper Makefile and packaging.
Diffstat (limited to 'tuned')
-rwxr-xr-xtuned33
1 files changed, 29 insertions, 4 deletions
diff --git a/tuned b/tuned
index 574265d..a1b6cab 100755
--- a/tuned
+++ b/tuned
@@ -20,9 +20,34 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+import sys, os.path
-from tuned import tuned
+if __name__ == "__main__":
+ try:
+ pid = os.fork()
+ if pid > 0:
+ sys.exit(0)
+ except OSError, e:
+ sys.exit(1)
-tuned.init(".")
-tuned.run()
-tuned.cleanup()
+ os.chdir("/")
+ os.setsid()
+ os.umask(0)
+
+ try:
+ pid = os.fork()
+ if pid > 0:
+ sys.exit(0)
+ except OSError, e:
+ sys.exit(1)
+
+ sys.stdout = sys.stderr = open("/dev/null", 'a+')
+ TUNEDDIR="/usr/share/tuned"
+ if not TUNEDDIR in sys.path:
+ sys.path.append(TUNEDDIR)
+
+ from tuned import tuned
+
+ tuned.init(TUNEDDIR)
+ tuned.run()
+ tuned.cleanup()