2018-07-24 00:06:04 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-06-21 17:42:52 +02:00
|
|
|
|
|
|
|
: "${EXPOSE_TCP:=false}"
|
|
|
|
|
2020-07-05 14:29:48 +02:00
|
|
|
networkdatadir="${LIGHTNINGD_DATA}/${LIGHTNINGD_NETWORK}"
|
|
|
|
|
2018-06-21 17:42:52 +02:00
|
|
|
if [ "$EXPOSE_TCP" == "true" ]; then
|
|
|
|
set -m
|
|
|
|
lightningd "$@" &
|
|
|
|
|
2022-05-13 17:55:23 +02:00
|
|
|
echo "Core-Lightning starting"
|
2018-06-21 17:42:52 +02:00
|
|
|
while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \
|
2020-07-05 14:29:48 +02:00
|
|
|
< <(inotifywait -e create,open --format '%f' --quiet "${networkdatadir}" --monitor)
|
2022-05-13 17:55:23 +02:00
|
|
|
echo "Core-Lightning started"
|
|
|
|
echo "Core-Lightning started, RPC available on port $LIGHTNINGD_RPC_PORT"
|
2018-06-21 17:42:52 +02:00
|
|
|
|
2020-07-05 14:29:48 +02:00
|
|
|
socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:${networkdatadir}/lightning-rpc" &
|
2018-06-21 17:42:52 +02:00
|
|
|
fg %-
|
|
|
|
else
|
2020-07-05 14:29:48 +02:00
|
|
|
exec lightningd --network="${LIGHTNINGD_NETWORK}" "$@"
|
2018-06-21 17:42:52 +02:00
|
|
|
fi
|