2023-02-26 19:15:24 +01:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
|
|
|
USE_PROCD=1
|
2023-12-01 14:43:12 +01:00
|
|
|
START=99
|
2023-02-26 19:15:24 +01:00
|
|
|
STOP=50
|
|
|
|
|
|
|
|
start_service() {
|
|
|
|
config_load emissary
|
|
|
|
|
|
|
|
mkdir -p /usr/share/emissary
|
2024-01-11 10:13:01 +01:00
|
|
|
mkdir -p /data/emissary
|
2023-02-26 19:15:24 +01:00
|
|
|
|
|
|
|
config_get emissary_reconciliation_interval agent 'reconciliation_interval' "60"
|
|
|
|
config_get emissary_server_url agent 'server_url' "https://emissary.cadol.es"
|
2023-10-13 12:29:51 +02:00
|
|
|
config_get emissary_sentry_dsn agent 'sentry_dsn' ""
|
|
|
|
config_get emissary_sentry_environment agent 'sentry_environment' ""
|
2023-02-26 19:15:24 +01:00
|
|
|
|
|
|
|
local config_file="/etc/emissary/agent.yml"
|
|
|
|
procd_open_instance emissary-agent
|
2023-10-13 12:29:51 +02:00
|
|
|
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval" EMISSARY_SENTRY_DSN="$emissary_sentry_dsn" EMISSARY_SENTRY_ENVIRONMENT="$emissary_sentry_environment"
|
2023-02-26 19:15:24 +01:00
|
|
|
procd_set_param command /usr/local/bin/emissary
|
|
|
|
procd_append_param command --workdir /usr/share/emissary
|
|
|
|
procd_append_param command --config "$config_file"
|
|
|
|
procd_append_param command agent run
|
2023-12-01 14:43:12 +01:00
|
|
|
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-17280}
|
2023-02-26 19:15:24 +01:00
|
|
|
procd_set_param file "$config_file"
|
|
|
|
procd_set_param stdout 1
|
|
|
|
procd_set_param stderr 1
|
|
|
|
procd_set_param pidfile /var/run/emissary-agent.pid
|
|
|
|
procd_close_instance
|
|
|
|
}
|
|
|
|
|
|
|
|
service_triggers()
|
|
|
|
{
|
|
|
|
# Reload service (restart) on emissary config changes
|
|
|
|
procd_add_reload_trigger "emissary"
|
|
|
|
}
|