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}"
|
|
|
|
|
2023-03-17 01:33:37 +01:00
|
|
|
set -m
|
|
|
|
lightningd --network="${LIGHTNINGD_NETWORK}" "$@" &
|
2018-06-21 17:42:52 +02:00
|
|
|
|
2023-03-17 01:33:37 +01:00
|
|
|
echo "Core-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)
|
2023-03-17 01:33:37 +01:00
|
|
|
|
|
|
|
if [ "$EXPOSE_TCP" == "true" ]; then
|
2022-05-13 17:55:23 +02:00
|
|
|
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
|
|
|
fi
|
2023-03-17 01:33:37 +01:00
|
|
|
|
|
|
|
# Now run any scripts which exist in the lightning-poststart.d directory
|
|
|
|
if [ -d "$LIGHTNINGD_DATA"/lightning-poststart.d ]; then
|
|
|
|
for f in "$LIGHTNINGD_DATA"/lightning-poststart.d/*; do
|
|
|
|
"$f"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
fg %-
|