Development
Prevent systemd logind service from turning off in idle state (background service)
chanbae
2024. 11. 19. 00:34
반응형
To set the logind service in systemd to poweroff when the server's state is idle, you can do the following
File: /etc/systemd/logind.conf
IdleAction=poweroff
IdleActionSec=30min
Then restart the systemd service with the command below and it will be reflected.
$ systemctl daemon-reload
$ systemctl restart systemd-logind.service
The problem here is that the determination of idle state is user interaction, so if the build goes back to the background and the user leaves the session, it will recognize it as idle and automatically turn off after 30 minutes. The workaround for this is to give the following command so that the service that goes back to the background doesn't fall into idle until it finishes.
$ systemd-inhibit --why="building" --what=idle bitbake core-image
After the bitbake core-image operation ends, idle time is counted from then on.