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 "$@" &
|
|
|
|
|
|
|
|
echo "C-Lightning starting"
|
|
|
|
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)
|
2018-06-21 17:42:52 +02:00
|
|
|
echo "C-Lightning started"
|
2018-06-26 02:17:53 +02:00
|
|
|
echo "C-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
|