Restarting a node in less time

I’m sure this annoys many of us. How can I restart a node without waiting a few minutes?

It used to be I just press “q” and the node seemed to close gracefully. And restarting it took about 20 seconds. Now I dont know any way other than killing the node, and waiting about 5 minutes for it to start again.

Gracefully…that’s your problem. It means that your node will only restart after finishing any active connections. IF you want quick, you have to restart the node using the sudo reboot command.

if u are using sudo systemctl restart cardano-node command u will wait more minutes

Try
sudo systemctl stop cardano-node
sudo systemctl start cardano-node

1 Like

Check the signal. You need to send signal 2 instead of 15 to your node process. Basically “INT” instead of “TERM”. If you send 15, the database will not be closed cleanly and your node will re-scan the DB for errors.

Systemd sends “TERM” by default followed by “KILL” in 90 seconds.
Docker and Podman send “TERM” as well.

In more details. Node code traps signals. Depending on which signal it receives, it acts accordingly. When it receives “INT”, it executes code that cleans everything up and closes the DB correctly. Upon closing the DB it marks it as “cleanly closed” (similar to the OS filesystem).

So send 2 - not 15. And most definitely NOT 9 lol

Please speak to me like I’m Biden. Be very slow and clear.

What must I type into the console to restart the node in less time.

I’ll try this though:
sudo systemctl stop cardano-node
sudo systemctl start cardano-node

Do you agree with this Ruslan?

Ah, I didn’t realise Biden was slow lol. I thought Bush was the idiot. Not a US citizen, sorry. Anyway…

“systemctl stop cardano-node” just uses the defaults to stop a process. The default is to send TERM signal to the process. You can modify the defaults.

I cannot tell you what to type cos I don’t know how it is set up. Show me your
systemd service unit file please.

But without knowing what you have there, the generic way to fix this would be this:

  1. Stop the service
  2. Open systemd file and add this line “KillSignal=SIGINT” to the [Service] section
  3. Run “systemctl daemon-reload”
  4. Start the service

Biden is Bitcoin on a Commodore 64 with 24k modem connected between Earth and the Moon. But it’s not him making the decisions anyway.

I’m following the instructions at Guide: How to build a Cardano Stake Pool - CoinCashew so it would be:

The Cardano node service (part of systemd)

file: /etc/systemd/system/cardano-node.service

[Unit]
Description = Cardano node service
Wants = network-online.target
After = network-online.target

[Service]
User = ${USER}
Type = simple
WorkingDirectory= ${NODE_HOME}
ExecStart = /bin/bash -c ‘${NODE_HOME}/startBlockProducingNode.sh’
KillSignal=SIGINT
RestartKillSignal=SIGINT
TimeoutStopSec=2
LimitNOFILE=32768
Restart=always
RestartSec=5
SyslogIdentifier=cardano-node

[Install]
WantedBy = multi-user.target

Hi,

Your systemd unit is correct. It is already doing what I suggested and sends the correct signal INT as you can see.
I just looked at this coin cashew thing and it doesn’t actually start the node itself. It starts the script wrapper instead.
Bash doesn’t forward signals to its children.
startBlockProducingNode.sh (parent) → cardano-node (child)
Basically, you are sending the signal to the script - not to the node process.
One of the easier options here is to exec out of the script.

Let’s try this. Open startBlockProducingNode.sh with your favourite editor.
Add the word “exec” right before you execute the node.
So the line “/usr/local/bin/cardano-node run …” in your wrapper script needs to change to “exec /usr/local/bin/cardano-node run …”

Stop the service.
Edit and save the file.
Start the service.
Wait for the node to boot completely.
Restart the service again.