示例#1
0
    def test_read_pidfile_0(self):
        self.unlink(self.pname)
        target.write_pidfile(self.pname, 30)

        ret = target.read_pidfile(self.pname)
        self.assertEquals('30', ret)
        self.unlink(self.pname)
示例#2
0
 def test_write_pidfile_1(self):
     self.unlink(self.pname)
     ret = target.write_pidfile(self.pname, 10)
     ret = target.write_pidfile(self.pname, 20)
     fp = open(self.pname, 'r')
     ret = fp.read()
     self.assertEquals('20', ret)
     self.unlink(self.pname)
示例#3
0
文件: er.py 项目: AdUser/pysilhouette
    def _setdaemon(self):
        if self.opts.daemon is True:
            pid = os.getpid()
            try:
                write_pidfile(self.opts.pidfile, pid)
            except Exception:
                self.logger.error('Could not create process file. - file=%s' % self.opts.pidfile)
                raise e

            self.logger.info('The process file was created. - file=%s' % self.opts.pidfile)
            return True
示例#4
0
    def _setdaemon(self):
        if self.opts.daemon is True:
            pid = os.getpid()
            try:
                write_pidfile(self.opts.pidfile, pid)
            except Exception:
                self.logger.error('Could not create process file. - file=%s' %
                                  self.opts.pidfile)
                raise e

            self.logger.info('The process file was created. - file=%s' %
                             self.opts.pidfile)
            return True
示例#5
0
 def test_write_pidfile_0(self):
     self.unlink(self.pname)
     ret = target.write_pidfile(self.pname, 12345)
     self.assertTrue(ret)
     self.unlink(self.pname)