cosmovisor is a process manager for Cosmos SDK application binaries that automates application binary switch at chain upgrades.
It polls the upgrade-info.json file that is created by the x/upgrade module at upgrade height, and then can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.
The systemd service manager allows the mantrachaind binary to run as a service, instead of as a command-line application. (See https://systemd.io for more information.)
sudotee/etc/systemd/system/mantrachaind.service>/dev/null<<EOF[Unit]Description=Mantra NodeAfter=network-online.target[Service]User=$USERExecStart=$(which cosmovisor) run startRestart=on-failureRestartSec=3LimitNOFILE=10000Environment="DAEMON_NAME=mantrachaind"Environment="DAEMON_HOME=$HOME/.mantrachain"Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"Environment="DAEMON_RESTART_AFTER_UPGRADE=true"Environment="UNSAFE_SKIP_BACKUP=true"[Install]WantedBy=multi-user.targetEOF
Starting, stoping and restarting service
#reload, enable and startsudosystemctldaemon-reloadsudosystemctlenablemantrachaindsudosystemctlstartmantrachaind#stopsudosystemctlstopmantrachaind#restartsudosystemctlrestartmantrachaind#logssudojournalctl-xefumantrachaind#logs - filtered on block height linessudojournalctl-xefumantrachaind-g".*txindex"
Once started, the node will take some time to sync with the blockchain.