Service Execution Layout - sirboldilox/Lua-Dev-OS GitHub Wiki

Services represent actual programs that will run when their certain event criteria happens.

Service file should be stored in a directory under /dev/opt. Their directory name should then be added to the srv.conf file under /dev. The directory should then contain two scripts start and run.

Example

  • cd /dev/opt/relay
  • ls
  • start run

The start script represents and commands and processes that should happen at system startup, such as opening channels, printing graphics to monitors, etc. The run script represents the program that will run when the event criteria occurs for the service.

Event Criteria

The shell executes <event_name.hd> when an event occurs and the file <event_name.hd> exists eg: redstone.hd These event files can the be used to run certain services or extra commands and should be configured accordingly.

The event handler modem_message.hd is already pre-configured. It will execute service names for specific rednet channels by storing the service name under the channels index in sys["netwk"]

Example

sys["netwk"][42] = "relay" -- The service under the folder "relay" will be executed if channel 42 receives a rednet message.