Skip to content
This repository has been archived by the owner on Feb 24, 2019. It is now read-only.

Services

Niklas Sombert edited this page Nov 2, 2014 · 6 revisions

Services are ... services, you know?

A service configuration looks like this:

from yarfi.ServicesAndTargets import Service as Srv

class Service(Srv):
	def __init__(self):
		self.description = "message bus"
		self.depends = ["filesystem"]
		self.conflicts = []
		self.respawn = True
	
	def start(self):
		pass #do something here
	
	def stop(self):
		pass #do something here
	
	def status(self):
		return ("running") #return either "running" or "stopped". (Or None.)

This should be pretty self-explanatory.

The files are placed in /etc/yarfi/services/ and are named [name of the service].py.

Oh, one thing: these files aren't parsed. They are just imported as modules. And, currently, there is no exception handling. Which means: if there's a syntax error in any configuration file, yarfi will crash.

Clone this wiki locally