Skip to content
CCPEDIAby Unity Nodes
App Development

How to check if Sandbox is running as a background process

6 posts529 views6 likesLast activity Dec 2021

  1. nemanjaOP 1

    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. Gary_Verhaegen 1

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

  3. nemanja

    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:

  4. Gary_Verhaegen 1

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

  5. cocreature 3

    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
    
  6. nemanja
    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!