0G node

This guide will walk you through migrating from using 0gchaind start [flags] to using Cosmovisor to manage your 0gchaind application. Cosmovisor offers the advantage of handling upgrades automatically without manual intervention.
Stop node
sudo systemctl stop 0gd.serviceDownload cosmovisor script to install
wget https://raw.githubusercontent.com/0glabs/0g-chain/dev/networks/testnet/init-cosmovisor.sh
- Check Script content
nano init-cosmovisor.shRun script
Before running this script, make sure Go is loaded in your current shell session.
If you haven’t loaded Go yet, please run the following command:
source $HOME/.bash_profile#requirement go version above v.1.22go versionchmod +x init-cosmovisor.sh./init-cosmovisor.sh /root/.0gchain- Reload profile
source ~/.profile
Edit service file to run with Cosmovisor
sudo tee /etc/systemd/system/0gd.service > /dev/null <<EOF[Unit]Description=Cosmovisor 0G NodeAfter=network.target
[Service]User=rootType=simpleExecStart=/root/go/bin/cosmovisor run start --log_output_consoleRestart=on-failureLimitNOFILE=65535Environment="DAEMON_NAME=0gchaind"Environment="DAEMON_HOME=/root/.0gchain"Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"Environment="DAEMON_RESTART_AFTER_UPGRADE=true"Environment="DAEMON_DATA_BACKUP_DIR=/root/.0gchain/cosmovisor/backup"Environment="UNSAFE_SKIP_BACKUP=true"
[Install]WantedBy=multi-user.targetEOF- Reload daemon and restart node
sudo systemctl daemon-reload && \sudo systemctl enable 0gd && \sudo systemctl restart 0gd && sudo systemctl status 0gd && \sudo journalctl -u 0gd -f -o cat
- Check logs
tail -f /root/.0gchain/log/chain.log