def start_slashdot_mainpage_scraper(): print(" >>> Starting slashdot scraper.") try: slashdot_job = UpstartJob(SLASHDOT_SCRAPER) slashdot_job.start() print(" >>> Scraper started successfully.") except: print(" >>> Scraper failed to start.")
def start_slashdot_api_server(): print(" >>> Starting slashdot server.") try: slashdot_job = UpstartJob(SLASHDOT_API) slashdot_job.start() print(" >>> Server started succesfully.") except: print("Slashdot server couldn't start.")
def get(self, _id): job = UpstartJob(_id, bus=self.bus) svc = Service(self) svc.id = _id svc.name = self.__fix_name(_id) try: svc.state = job.get_status()['state'] svc.running = svc.state == 'running' except: svc.running = False return svc
def get_service(self, _id): job = UpstartJob(_id, bus=self.bus) svc = Service(self) svc.id = _id svc.name = self.__fix_name(_id) try: svc.state = job.get_status()['state'] svc.running = svc.state == 'running' except: svc.running = False return svc
def stop_slashdot_api_server(): jobs = show_upstart_jobs() slashdot_job = None for job in jobs: if job == SLASHDOT_API: try: print(" >>> Stopping slashdot api") slashdot_job = UpstartJob(str(job)) slashdot_job.stop() except: print("Job is not running.") else: pass
def stop_slashdot_mainpage_scraper(): jobs = show_upstart_jobs() slashdot_job = None for job in jobs: if job == SLASHDOT_SCRAPER: try: print(" >>> Stopping scraper.") slashdot_job = UpstartJob(str(job)) slashdot_job.stop() print(" >>> Scraper stopped succesfully.") except: pass else: pass
def get_service(self, _id): """ Get informations from module upstart for one specified job. :param _id: Job name :type _id: string :return: Service object :rtype: Service """ job = UpstartJob(_id, bus=self.bus) svc = Service(self) svc.id = _id svc.name = self.__fix_name(_id) try: svc.state = job.get_status()['state'] svc.running = svc.state == 'running' except Exception as e: svc.running = False return svc
def stop(self, _id): """ Basically stop a job. :param _id: job name :type _id: string """ try: UpstartJob(_id).stop() except DBusException as e: raise ServiceOperationError(e)
def restart(self, _id): UpstartJob(_id).restart()
def stop(self, _id): UpstartJob(_id).stop()
def start(self, _id): UpstartJob(_id).start()
def restart(self, _id): try: UpstartJob(_id).restart() except DBusException as e: raise ServiceOperationError(e)