Process management with pm2
It is recommended to set up additional process management with the new Lisk Core CLI. Any process management tool can be used to manage the Lisk Core node. We recommend using PM2 to manage the instance.
PM2 config
Create a pm2 config, for example as shown below:
pm2.conf.json
{
"name": "lisk-core",
"script": "lisk-core start --overwrite-config",
"env": {
"LISK_NETWORK": "testnet",
"LISK_CONFIG_FILE": "/home/lisk/lisk-core/custom-config.json"
}
}
All available options for scripts and env can be found in lisk-core start --help .
|
To add the process to PM2 and start it directly, execute the following command:
pm2 start pm2.conf.json
Show status
View the status of Lisk Core in the list of running PM2 processes:
pm2 ls
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐ │ id │ name │ mode │ ↺ │ status │ cpu │ memory │ ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤ │ 0 │ lisk-core │ fork │ 0 │ online │ 0% │ 3.1mb │ └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
Saving the app list to be restored at reboot
Once Lisk Core is started, it is convenient to save the app list so it will respawn after rebooting:
pm2 save
For more information, please refer to https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/