diff --git a/README.md b/README.md index fed4589..274cb16 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ The `testnet` script will load `config/local-testnet.yaml` and `config/testnet.y ## CKB Node Restart Script -Because of unstable network, sometimes the CKB node may disconnect from peers and stop syncing blocks. To solve this problem, the script `scripts/ckb-node-monit.js` can restart the CKB node automatically: +Because of unstable network, sometimes the CKB node may disconnect from peers and stop syncing blocks. To solve this problem, the script `scripts/ckb-node-monit.mjs` can restart the CKB node automatically: ```bash pm2 start --cron-restart="* * * * *" \ -./scripts/ckb-node-monit.js -- \ +./scripts/ckb-node-monit.mjs -- \ --log /path_to_ckb_node_log_dir/run.log \ --data ./ckb-node-status.json ``` diff --git a/scripts/ckb-node-monit.js b/scripts/ckb-node-monit.mjs similarity index 96% rename from scripts/ckb-node-monit.js rename to scripts/ckb-node-monit.mjs index 465920c..435c116 100644 --- a/scripts/ckb-node-monit.js +++ b/scripts/ckb-node-monit.mjs @@ -1,13 +1,13 @@ // Start command: // pm2 start --cron-restart="* * * * *" \ -// ./ckb-node-monit.js -- \ +// ./ckb-node-monit.mjs -- \ // --log /path_to_ckb_node_log_dir/run.log \ // --data ./ckb-node-status.json -const fs = require('fs'); -const readline = require('readline'); -const { spawn } = require('child_process'); +import fs from 'fs' +import readline from 'readline' +import { spawn } from 'child_process' const newBlockTimeout = 180 * 1000; // 3 minutes const restartTimeout = 300 * 1000; // 5 minutes