'Restart with same command line arguments'

def do_restart(self, arg):

    argv0 = os.readlink('/proc/self/exe')
    argv = [x for x in open('/proc/self/cmdline').read().split('\x00') if x]
    if self.dnscnc:
        self.display_success('Stopping    DNSCNC')
        self.dnscnc.stop()
    if self.pupsrv.server:
        self.display_success('Stopping    listener')
        self.pupsrv.server.close()
    self.display_success('Restarting')
    os.execv(argv0, argv)
