Hello,
tl;dr: Is there any way to pass an environment variable to a daemon
started with rc.d?
A bit of context for those interested:
I'm trying to run Apache Airflow from an rc.d script so I can make use
of rcctl and other niceties. My rc.d script is included below.
The problem I'm facing is that it seems that Airflow looks for various
environment variables such as $HOME, $AIRFLOW_HOME, $AIRFLOW_CONFIG etc
and I'm seeing no obvious way to pass those requisite environment
variables to Airflow from my rc.d script. Without these variables set,
Airflow annoyingly just looks in /dev/null for everything and fails to
function.
I'm probably missing something obvious, but hoping the fine folks here
can point me in the right direction.
Regards,
Jordan
# Airflow scheduler rc.d script:
#!/bin/ksh
#
daemon="/usr/local/bin/airflow scheduler -D"
daemon_flags="-l - --stderr - --stdout -"
daemon_user="_airflowd"
daemon_logger="daemon.info"
daemon_timeout="60"
. /etc/rc.d/rc.subr
pexp=".*python.* ${daemon} ${daemon_flags}"
rc_reload=NO
rc_pre() {
rm -f /var/airflow/airflow/airflow-scheduler.pid
}
rc_cmd $1
# Airflow webserver r rc.d script:
#!/bin/ksh
#
daemon="/usr/local/bin/airflow webserver -D -E -"
daemon_flags="-p 8080 -l - --stderr - --stdout -"
daemon_user="_airflowd"
daemon_logger="daemon.info"
. /etc/rc.d/rc.subr
pexp=".*python.* ${daemon} ${daemon_flags}"
rc_reload=NO
rc_pre() {
rm -f /var/airflow/airflow/airflow-webserver.pid \
/var/airflow/airflow/airflow-webserver-monitor.pid
}
rc_cmd $1