Beispiel #1
0
    def test_svcontrol(self):
        self.assertFalse(svcontrol('/some/nonexisting/directory', 'u'))
        self._create_test_daemon(1)
        p = self._daemon_dir(1)
        self.assertTrue(svcontrol(p, 'u'))
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertTrue(svstat(p)['daemon_up'])

        ts1 = svstat(p)['daemon_timestamp']
        svcontrol(p, 'd')  # stop the daemon
        time.sleep(1)
        ts2 = svstat(p)['daemon_timestamp']
        self.assertGreater(ts2, ts1)
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertFalse(svstat(p)['daemon_up'])

        svcontrol(p, 'o')  # start daemon in 'run_once' mode
        time.sleep(1)
        ts3 = svstat(p)['daemon_timestamp']
        self.assertGreater(ts3, ts2)
        self.assertTrue(svstat(p)['daemon_once'])
        self.assertTrue(svstat(p)['daemon_up'])

        svcontrol(p, 'd')  # start the daemon up again
        time.sleep(1)
        self.assertGreater(ts3, ts2)
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertFalse(svstat(p)['daemon_up'])
Beispiel #2
0
    def test_svcontrol(self):
        self.assertFalse(svcontrol('/some/nonexisting/directory', 'u'))
        self._create_test_daemon(1)
        p = self._daemon_dir(1)
        self.assertTrue(svcontrol(p, 'u'))
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertTrue(svstat(p)['daemon_up'])

        ts1 = svstat(p)['daemon_timestamp']
        svcontrol(p, 'd')  # stop the daemon
        time.sleep(1)
        ts2 = svstat(p)['daemon_timestamp']
        self.assertGreater(ts2, ts1)
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertFalse(svstat(p)['daemon_up'])

        svcontrol(p, 'o')  # start daemon in 'run_once' mode
        time.sleep(1)
        ts3 = svstat(p)['daemon_timestamp']
        self.assertGreater(ts3, ts2)
        self.assertTrue(svstat(p)['daemon_once'])
        self.assertTrue(svstat(p)['daemon_up'])

        svcontrol(p, 'd')  # start the daemon up again
        time.sleep(1)
        self.assertGreater(ts3, ts2)
        self.assertFalse(svstat(p)['daemon_once'])
        self.assertFalse(svstat(p)['daemon_up'])
Beispiel #3
0
def stop_supervise(dir_name):
    svcontrol(os.path.join(_service_dir(), dir_name), 'x')
Beispiel #4
0
def stop_daemon(dir_name):
    return svcontrol(os.path.join(_service_dir(), dir_name), 'd')
Beispiel #5
0
def stop_supervise(dir_name):
    svcontrol(os.path.join(_service_dir(), dir_name), 'x')
Beispiel #6
0
def stop_daemon(dir_name):
    return svcontrol(os.path.join(_service_dir(), dir_name), 'd')