stop-validator.mjs 386 B

12345678910111213
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. const isValidatorRunning = (await $`lsof -t -i:8899`.quiet().exitCode) === 0;
  4. if (isValidatorRunning) {
  5. // Kill the validator if it's already running.
  6. await $`pkill -f solana-test-validator`.quiet();
  7. await sleep(1000);
  8. echo(chalk.green('Local validator terminated!'));
  9. } else {
  10. echo(chalk.yellow('Local validator is not running.'));
  11. }