How to automatically start the canton node after the linux system restarts?

I want to use a non-root user to automatically start canton’s service node after booting, but an error occurs. Thanks for your help.

  1. Write the sequencer.service file as follows:
[Unit]
Description=sequencer
After=network.target remote-fs.target nss-lookup.target
Requires=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=canton daemon -c /opt/conf/postgres-sequencer-mediator.conf,/opt/conf/sequencer1.conf
User=ws_app
Environment=SYSTEMD_LOG_LEVEL=debug
[Install]
WantedBy=multi-user.target
  1. Put it in the systemd/system directory

  2. systemctl enable sequencer.service

  3. After restarting the system, journalctl -u sequencer.service -f
    The log is as follows:

Hi,

I think you participant does not start because it cannot create log files.

By default Canton, writes its logs in two files, namely log/canton.log for standard logs and log/canton_errors.log to capture events for logging.last_errors commands

Since your non-root user probably has no rights over these paths, you should override them with paths your user can write to.

  • the path for standard logging can be specify using the command line --log-file-name or the environment variable LOG_FILE_NAME
  • the path for logging logging.last_errors commands cannot specify by the environment variable LOG_LAST_ERRORS_FILE_NAME or can be disabled with the flag --log-last-errors false.

Cheers

3 Likes

Following your solution, the problem is solved, thank you very much!