Skip to content
Discussions/App Development/How to check if Sandbox is running as a background processForum ↗

How to check if Sandbox is running as a background process

App Development6 posts473 views6 likesLast activity Dec 2021
NE
nemanjaOP
Dec 2021

What would be the best way to check if Sandbox is running as a background process (with default parameters)? Would it be using ps x?

GA
Gary_Verhaegen
Dec 2021

“Best” will definitely depend on your context here. I personally like to check if the port is open, with something like:

while ! nc -z localhost:6865; do sleep 1; done

Well, I’m usually waiting for a sandbox; if you just wanted to check, you can change that while into an if.

This only tells you that something has that port open; if you’re in a context where you may not know whether that something is a sandbox, you may want to instead send a query to it with grpcrul, perhaps to an unauthenticated endpoint like ListKnownPackages or GetLedgerIdentityRequest.

NE
nemanja
Dec 2021

Thnx for the super speedy reply @Gary_Verhaegen :grinning: What would be the shell command for grpcrul to ListKnownPackages? I realise I’m being a but spoiled and ask for a full solution :slight_smile:

GA
Gary_Verhaegen
Dec 2021

I have no idea, I’ve never used grpcurl myself. Sorry, that’s as far as I’m able to take you tonight.

CO
cocreature
Dec 2021

Rather than using the party management service which still requires a valid token (but no specific claims), I’d recommend the healthcheck endpoint. You can talk to that via grpcurl using the following command

grpcurl -plaintext localhost:6865 grpc.health.v1.Health/Check
NE
nemanja
Dec 2021
cocreature:

grpcurl -plaintext localhost:6865 grpc.health.v1.Health/Check

Awesome, that did the trick! Running the command returns

{
  "status": "SERVING"
}

Thnx for your help @Gary_Verhaegen and @cocreature!

← Back to Discussions