def terminate(self): kill_cmd = "kill -9 %s" % self.get_pid() if os.path.isfile(self.__pid_path): servo.run_as_sudo(kill_cmd) if self.check_haproxy_process() == 0: raise ServoError("haproxy still running") self.__status = HaproxyProcess.TERMINATED
def terminate(self): kill_cmd = 'kill -9 %s' % self.get_pid() if os.path.isfile(self.__pid_path): servo.run_as_sudo(kill_cmd) if self.check_haproxy_process() == 0: raise ServoError("haproxy still running") self.__status = HaproxyProcess.TERMINATED
def terminate(self): pids = self.get_pids() for pid in pids: kill_cmd = 'kill -9 %s' % pid servo.run_as_sudo(kill_cmd) if self.check_haproxy_process() == 0: raise ServoError("haproxy still running") self.__status = HaproxyProcess.TERMINATED
def unmount_floppy(self, dir=config.FLOPPY_MOUNT_DIR): if not os.path.exists(dir): return if servo.run_as_sudo('/bin/umount %s' % dir) == 0: servo.log.debug('floppy disk unmounted on ' + dir) else: raise Exception('failed to unmount floppy')
def mount_floppy(self, dev='/dev/fd0', dir=config.FLOPPY_MOUNT_DIR): if not os.path.exists(dir): os.makedirs(dir) if servo.run_as_sudo('/bin/mount %s %s' % (dev, dir)) == 0: servo.log.debug('floppy disk mounted on ' + dir) else: raise Exception('failed to mount floppy')
def mount_floppy(self, dev='/dev/fd0', dir=config.FLOPPY_MOUNT_DIR): if not os.path.exists(dir): os.makedirs(dir) if servo.run_as_sudo('/bin/mount -o uid=%d %s %s' % (os.geteuid(), dev, dir)) == 0: servo.log.debug('floppy disk mounted on ' + dir) else: raise Exception('failed to mount floppy')
def run(self): # make sure no other haproxy process running if self.__status == HaproxyProcess.RUNNING or self.check_haproxy_process() == 0: raise ServoError("haproxy already running") haproxy_cmd = "%s -f %s -p %s -V -C %s -D" % (self.__haproxy_bin, self.__conf_file, self.__pid_path, RUN_ROOT) if servo.run_as_sudo(haproxy_cmd) != 0: raise ServoError("failed to launch haproxy process") self.__status = HaproxyProcess.RUNNING
def restart(self): if self.check_haproxy_process() != 0: servo.log.warning('on restart, no running haproxy process found') haproxy_cmd = '%s -f %s -p %s -V -C %s -D -sf %s)' % ( self.__haproxy_bin, self.__conf_file, self.__pid_path, RUN_ROOT, self.get_pid()) if servo.run_as_sudo(haproxy_cmd) != 0: raise ServoError("failed to restart haproxy process") self.__status = HaproxyProcess.RUNNING
def run(self): # make sure no other haproxy process running if self.__status == HaproxyProcess.RUNNING or self.check_haproxy_process( ) == 0: raise ServoError("haproxy already running") haproxy_cmd = '%s -f %s -p %s -V -C %s -D' % ( self.__haproxy_bin, self.__conf_file, self.__pid_path, RUN_ROOT) if servo.run_as_sudo(haproxy_cmd) != 0: raise ServoError("failed to launch haproxy process") self.__status = HaproxyProcess.RUNNING
def restart(self): if self.check_haproxy_process() != 0: servo.log.warning("on restart, no running haproxy process found") haproxy_cmd = "%s -f %s -p %s -V -C %s -D -sf %s)" % ( self.__haproxy_bin, self.__conf_file, self.__pid_path, RUN_ROOT, self.get_pid(), ) if servo.run_as_sudo(haproxy_cmd) != 0: raise ServoError("failed to restart haproxy process") self.__status = HaproxyProcess.RUNNING