2018-07-25 16:08:53 -06:00
|
|
|
defmodule Farmbot.OS.ShoehornHandler do
|
|
|
|
use Shoehorn.Handler
|
|
|
|
require Logger
|
|
|
|
|
|
|
|
def init do
|
|
|
|
{:ok, %{}}
|
|
|
|
end
|
|
|
|
|
|
|
|
def application_exited(:farmbot_core, reason, state) do
|
|
|
|
Logger.error "FarmbotCore exited: #{inspect reason}"
|
2018-11-23 11:25:14 -07:00
|
|
|
Application.stop(:farmbot)
|
|
|
|
Application.ensure_all_started(:farmbot)
|
2018-07-25 16:08:53 -06:00
|
|
|
{:continue, state}
|
|
|
|
end
|
|
|
|
|
2018-11-23 11:25:14 -07:00
|
|
|
def application_exited(:farmbot, reason, state) do
|
2018-07-25 16:08:53 -06:00
|
|
|
Logger.error "FarmbotOS exited: #{inspect reason}"
|
2018-11-23 11:25:14 -07:00
|
|
|
Application.ensure_all_started(:farmbot)
|
2018-07-25 16:08:53 -06:00
|
|
|
{:continue, state}
|
|
|
|
end
|
|
|
|
|
|
|
|
def application_exited(:farmbot_ext, reason, state) do
|
|
|
|
Logger.error "FarmbotExt exited: #{inspect reason}"
|
|
|
|
Application.ensure_all_started(:farmbot_ext)
|
|
|
|
{:continue, state}
|
|
|
|
end
|
|
|
|
|
|
|
|
def application_exited(_app, _reason, state) do
|
|
|
|
{:continue, state}
|
|
|
|
end
|
|
|
|
end
|