Fix PID file for Libra tools.

Using the `lockfile` module didn't produce a PID file that
contained the process PID number, just an empty .lck file.
Using the TimeoutPIDLockFile distributed with the `daemon`
module gives us what we expect: a .pid file with the PID
number as the contents.
This commit is contained in:
David Shrewsbury
2012-10-05 12:28:10 -04:00
parent 25cac0ebc5
commit e62692dc8f
2 changed files with 4 additions and 4 deletions

View File

@@ -14,8 +14,8 @@
# under the License. # under the License.
import daemon import daemon
import daemon.pidfile
import grp import grp
import lockfile
import pwd import pwd
import signal import signal
import sys import sys
@@ -68,7 +68,7 @@ def main():
context = daemon.DaemonContext( context = daemon.DaemonContext(
working_directory='/etc/haproxy', working_directory='/etc/haproxy',
umask=0o022, umask=0o022,
pidfile=lockfile.FileLock(args.pid), pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid),
files_preserve=[logger.handlers[0].stream] files_preserve=[logger.handlers[0].stream]
) )
if args.user: if args.user:

View File

@@ -13,10 +13,10 @@
# under the License. # under the License.
import daemon import daemon
import daemon.pidfile
import gearman.errors import gearman.errors
import grp import grp
import json import json
import lockfile
import pwd import pwd
import socket import socket
from time import sleep from time import sleep
@@ -195,7 +195,7 @@ def main():
context = daemon.DaemonContext( context = daemon.DaemonContext(
working_directory='/etc/haproxy', working_directory='/etc/haproxy',
umask=0o022, umask=0o022,
pidfile=lockfile.FileLock(args.pid), pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid),
files_preserve=[logger.handlers[0].stream] files_preserve=[logger.handlers[0].stream]
) )
if args.user: if args.user: