def install(self): super(Nssm, self).install() self.deploy_service_file( self.svc_file_path, self.svc_file_dest, create_directory=True) if not os.path.isfile(self.nssm_exe): self._deploy_nssm_binary() utils.run(self.svc_file_dest)
def nssm(self, cmd): return utils.run('{0} {1} {2}'.format(self.nssm_exe, cmd, self.name))
def is_service_exists(self): code, _, _ = utils.run('sc query {0}'.format(self.name)) if code != 0: return False return True
def uninstall(self): utils.run('sc config {0} start= disabled'.format(self.name)) utils.run('{0} remove {1} confirm'.format(self.nssm_exe, self.name)) if os.path.isfile(self.svc_file_dest): os.remove(self.svc_file_dest)
def stop(self): utils.run('sc stop {0}'.format(self.name))
def start(self): utils.run('sc start {0}'.format(self.name))