diff options
author | Martin Abente <martin.abente.lahaye@gmail.com> | 2011-01-28 13:39:54 (GMT) |
---|---|---|
committer | Martin Abente <martin.abente.lahaye@gmail.com> | 2011-01-28 13:54:31 (GMT) |
commit | e4b76c7452b91e9c4f3d8d26eab05fac0e2bfd53 (patch) | |
tree | 97256e2bbb286b46eb2947e651711e25382b5a9d | |
parent | dab1d95f32f433f23e089da51d435ba9716562bf (diff) |
use pidfile in the same dir
-rwxr-xr-x | fbdaemon.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fbdaemon.py b/fbdaemon.py index 7fe0a58..89845c2 100755 --- a/fbdaemon.py +++ b/fbdaemon.py @@ -17,6 +17,7 @@ # This source code is based on Sander Marechal's examples provided at # http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ +import os import sys from daemon import Daemon @@ -26,7 +27,10 @@ class FeedbackDaemon(Daemon): fbserver.listen() if __name__ == "__main__": - daemon = FeedbackDaemon('/tmp/fbdaemon.pid') + script_path = os.path.abspath(__file__) + pidfile_path = os.path.join(os.path.dirname(script_path), 'server.pid') + daemon = FeedbackDaemon(pidfile_path) + if len(sys.argv) == 2: if 'start' == sys.argv[1]: daemon.start() |