@ -5,6 +5,8 @@ APP_NAME="btcpayserver"
ACTION = " ${ 1 } "
shift 1
mkdir -p /usr/local/bin
get_image( ) {
do_install_detail
}
@ -76,29 +78,36 @@ case "${ACTION}" in
do_install_detail
; ;
"rm" )
IMAGE_NAME = $( uci get btcpayserver.@btcpayserver[ 0] .image_name 2>/dev/null)
[ -z " $IMAGE_NAME " ] && IMAGE_NAME = "btcpayserver"
CONTAINER_IDS = $( docker ps -a --filter " ancestor= ${ IMAGE_NAME } " --format '{{.ID}}' )
echo "Stopping and removing containers..."
CONTAINER_IDS = $( docker ps -a | grep 'btcpayserver\|generated_' | awk '{print $1}' )
for ID in $CONTAINER_IDS ; do
docker stop " $ID "
docker rm " $ID "
done
docker rmi -f " $IMAGE_NAME "
IMAGE_IDS = $( docker images | grep 'btcpayserver' | awk '{print $3}' )
if [ -n " $IMAGE_IDS " ] ; then
docker rmi -f $IMAGE_IDS
fi
rm -r /opt/docker2/compose/btcpayserver 2>/dev/null
rm -rf /opt/docker2/compose/btcpayserver/btcpayserver-docker 2>/dev/null # Removing the btcpayserver-docker directory
; ;
"start" | "stop" | "restart" )
APP_NAME = "btcpayserver"
CONTAINER_IDS = $( docker ps -a --filter " ancestor= ${ APP_NAME } " --format '{{.ID} }')
CONTAINER_IDS = $( docker ps -a | grep 'btcpayserver\|generated_' | awk '{print $1 }')
for ID in $CONTAINER_IDS ; do
docker " ${ ACTION } " " ${ ID } "
done
; ;
"status" )
APP_NAME = "btcpayserver"
CONTAINER_NAMES = $( docker ps -a --filter " name= ${ APP_NAME } " --format '{{.Names}}' )
docker ps --all -f " name= ${ CONTAINER_NAMES } " --format '{{.Status}}'
CONTAINER_NAME = "generated_btcpayserver_1"
CONTAINER_STATUS = $( docker ps --all --filter " name= ${ CONTAINER_NAME } " --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }' )
if [ -z " $CONTAINER_STATUS " ] ; then
echo " ${ APP_NAME } is not installed "
else
echo " ${ CONTAINER_STATUS } "
fi
; ;
"port" )
APP_NAME = "btcpayserver"
CONTAINER_NAMES = $( docker ps -a --filter " ancestor= ${ APP_NAME } " --format '{{.Names}}' )