Commit 856268f2 authored by Vangelis Koukis's avatar Vangelis Koukis

Change process title to simplify 'ps' display

Use python-setproctitle to change the process title
of the running daemon. Make it appear as a native executable
to simplify administration.
parent ca7b6d21
......@@ -35,6 +35,7 @@ import daemon.runner
import daemon.pidlockfile
import nfqueue
import pyinotify
import setproctitle
from lockfile import LockTimeout
import IPy
......@@ -52,6 +53,7 @@ from scapy.layers.inet6 import IPv6, ICMPv6ND_RA, ICMPv6ND_NA, \
ICMPv6NDOptRDNSS
from scapy.layers.dhcp import BOOTP, DHCP
DEFAULT_CONFIG = "/etc/nfdhcpd/nfdhcpd.conf"
DEFAULT_PATH = "/var/run/ganeti-dhcpd"
DEFAULT_USER = "nobody"
......@@ -990,6 +992,10 @@ if __name__ == "__main__":
handler.setFormatter(logging.Formatter(LOG_FORMAT))
logger.addHandler(handler)
# Rename this process so 'ps' output looks like
# this is a native executable
setproctitle.setproctitle(" ".join(sys.argv))
if opts.daemonize:
pidfile = daemon.pidlockfile.TimeoutPIDLockFile(
config["general"]["pidfile"], 10)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment