Creating Startup Scripts and Services
To run an instance of Cardano Node, create a bash script to configure options. Also, implement Cardano Node as a systemd
service.
Running Cardano Node as a systemd
service maximizes the uptime of your stake pool by restarting the stake pool automatically if any stake pool processes may crash, or when the computer reboots.
To create a startup script and service for an instance of Cardano Node:
On the computer hosting your block producing node, using a terminal window type the following command to navigate to the folder containing configuration files and scripts related to operating your Cardano node:
You set the $NODE_HOME
environment variable when Installing GHC and Cabal.
To retrieve the values of the
$NODE_HOME
and$USER
environment variables, type:
In the folder where you navigated in step 1, using a text editor create a file named
startCardanoNode.sh
and then add the following contents to the file where<NodeHomeValue>
is the value of your$NODE_HOME
environment variable that you retrieved in step 2:
You configured the topology-legacy.json
file when Configuring Legacy Stake Pool Topology. You downloaded the config.json
file when Downloading Configuration Files. For more details on options for the cardano-node run
command, see the topic How to run cardano-node in the Cardano Developer Portal.
Save and close the
startCardanoNode.sh
file.To set execute permissions for the
startCardanoNode.sh
file, type:
To create the folder where Cardano Node stores blockchain data, type:
To run Cardano Node as a service, using a text editor create a file named
cardano-node.service
and then add the following contents to the file where<UserValue>
is the value of your$USER
environment variable and<NodeHomeValue>
is the value of your$NODE_HOME
environment variable that you retrieved in step 2:
Save and close the
cardano-node.service
file.To move the
cardano-node.service
file to the folder/etc/systemd/system
and set file permissions, type:
To start Cardano Node as a service when the computer boots, type:
Repeat steps 1 to 10 on each computer hosting a relay node in your stake pool configuration.
Managing Services
To help administer an instance of Cardano Node running as a systemd
service, use the following commands.
To view the status of the Cardano Node service, type:
To restart the Cardano Node service, type:
To stop the Cardano Node service, type:
To display and filter logs, type one of the following commands, for example:
If you are not satisfied with the performance of an instance of Cardano Node, then see the topic Configuring Runtime Options.