How to check if Sandbox is running as a background process

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?

2 Likes

“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.

1 Like

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:

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

1 Like

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
3 Likes

Awesome, that did the trick! Running the command returns

{
  "status": "SERVING"
}

Thnx for your help @Gary_Verhaegen and @cocreature!