How to automatically start the canton node after the linux system restarts?
App Development3 posts231 views3 likesLast activity Nov 2022
KE
kevin_fanOP
Oct 2022I want to use a non-root user to automatically start canton’s service node after booting, but an error occurs. Thanks for your help.
- 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
-
Put it in the systemd/system directory
-
systemctl enable sequencer.service
-
After restarting the system, journalctl -u sequencer.service -f
The log is as follows:
RE
Remy
Oct 2022Hi,
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-nameor the environment variableLOG_FILE_NAME - the path for logging logging.last_errors commands cannot specify by the environment variable
LOG_LAST_ERRORS_FILE_NAMEor can be disabled with the flag--log-last-errors false.
Cheers
KE
kevin_fan
Nov 2022Following your solution, the problem is solved, thank you very much!
