Is it possible that systemctl process would not run without me being logged in to the server?
0
votes
1
answer
97
views
I am very new to linux and I need some help. I am trying to put blockchain node processes on the background so that they run without my being logged in.
I am using
to run my process in the background.
Here are my .service
files
Root dir, command, identifiers and user were just redacted from the file they are not being imported. Also the cmds work in the "foreground" that being when I simply run them in the terminal.
1st
[Unit]
Description=MY_DESC
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
User=USER
WorkingDirectory=ROOT_DIR
ExecStart=MY_COOL_CMD
StandardOutput=journal
StandardError=journal
SyslogIdentifier=MY_ID
StartLimitInterval=0
LimitNOFILE=65536
LimitNPROC=65536
[Install]
WantedBy=multi-user.target
2nd service file
[Unit]
Description=MY_DESC
After=network.target 1st-service.service
[Service]
Type=simple
Restart=always
RestartSec=1
User=USER
WorkingDirectory=HOME_DIR
Environment="DAEMON_NAME=CMD_DIR"
Environment="DAEMON_HOME=HOME_DIR"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="UNSAFE_SKIP_BACKUP=true"
ExecStart=MY_COOL_CMD
StandardOutput=journal
StandardError=journal
SyslogIdentifier=MY_ID
StartLimitInterval=0
LimitNOFILE=65536
LimitNPROC=65536
[Install]
WantedBy=multi-user.target
I enabled both files successfully. They seem to be running when I am logged in, but not when I am away. There are no errors, but when I check the logs the block numbers did not rack up enough (last time it has been a week since I have been logged out and the block height has jumped up only by 100,000 blocks. Which is not a lot). Also when try to check the logs in the past (between 6 and 7 hours ago) the logs show no entry...
Here is what I get when I ask for status
1st
my.service - MY_DESC
Loaded: loaded (/etc/systemd/system/my.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-11-29 22:57:00 CET; 1 week 0 days ago
Main PID: 1940037 (geth)
Tasks: 23 (limit: 19099)
Memory: 9.8G
CPU: 4d 21h 2min 16.071s
CGroup: /system.slice/my.service
└─1940037 MY_COOL_CMD
2nd file
my.service - my
Loaded: loaded (/etc/systemd/system/my.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-11-29 23:02:23 CET; 1 week 0 days ago
Main PID: 1940098 (cosmovisor)
Tasks: 28 (limit: 19099)
Memory: 4.7G
CPU: 3d 4h 49min 4.542s
CGroup: /system.slice/my.service
├─1940098 CMD_HERE
└─1940111 CMD_HERE
That is when I am logged in.
If there is anything else that you need to see to give me some guidance in this matter please let me know.
Thank you very much for your time and expertise!
Asked by tonymasek
(9 rep)
Dec 7, 2024, 08:02 PM
Last activity: Dec 8, 2024, 07:17 AM
Last activity: Dec 8, 2024, 07:17 AM