Re: systemctl log verbosity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 17 Aug 2021, Dave Close wrote:
> I'm trying to run "systemctl show" in a cron script. It works but I get
> a huge number of extra lines in my log for each run. Why? Can this be
> suppressed. I don't want to overfill the log.
> 
> There is nothing in the man page (that I noticed) indicating that "show"
> causes anything to be logged. But here's an example of what I see.
> 
> >Aug 16 16:10:01 svcs systemd[1]: Created slice User Slice of UID 0.
> >Aug 16 16:10:01 svcs systemd[1]: Starting User Runtime Directory /run/user/0...
> >Aug 16 16:10:01 svcs systemd[1]: Finished User Runtime Directory /run/user/0.
> >Aug 16 16:10:01 svcs systemd[1]: Starting User Manager for UID 0...
> >Aug 16 16:10:01 svcs systemd[80491]: Queued start job for default target Main User Target.
> >Aug 16 16:10:01 svcs systemd[80491]: Created slice User Application Slice.
> >Aug 16 16:10:01 svcs systemd[80491]: Condition check resulted in Mark boot as successful after the 
> user session has run 2 minutes being skipped.
> >Aug 16 16:10:01 svcs systemd[80491]: Started Daily Cleanup of User's Temporary Directories.
> >Aug 16 16:10:01 svcs systemd[80491]: Reached target Paths.
> >Aug 16 16:10:01 svcs systemd[80491]: Reached target Timers.
> >Aug 16 16:10:01 svcs systemd[80491]: Starting D-Bus User Message Bus Socket.
> >Aug 16 16:10:01 svcs systemd[80491]: Condition check resulted in PipeWire PulseAudio being skipped.
> >Aug 16 16:10:01 svcs systemd[80491]: Listening on Multimedia System.
> >Aug 16 16:10:01 svcs systemd[80491]: Starting Create User's Volatile Files and Directories...
> >Aug 16 16:10:01 svcs systemd[80491]: Finished Create User's Volatile Files and Directories.
> >Aug 16 16:10:01 svcs systemd[80491]: Listening on D-Bus User Message Bus Socket.
> >Aug 16 16:10:01 svcs systemd[80491]: Reached target Sockets.
> >Aug 16 16:10:01 svcs systemd[80491]: Reached target Basic System.
> >Aug 16 16:10:01 svcs systemd[80491]: Reached target Main User Target.
> >Aug 16 16:10:01 svcs systemd[80491]: Startup finished in 151ms.
> >Aug 16 16:10:01 svcs systemd[1]: Started User Manager for UID 0.
> >Aug 16 16:10:01 svcs systemd[1]: Started Session 72 of User root.
> >Aug 16 16:10:01 svcs root[80504]: ## logger output from cron script ##
> >Aug 16 16:10:01 svcs systemd[1]: session-72.scope: Deactivated successfully.
> 
> I see these additional 23 lines (plus the one-line script output) every
> time the script runs. That seems excessively verbose to me.
> 
> The system is Fedora 34 x86_64.

Cron jobs are run with pam_systemd, so they are run within a logind 
session. If there is no other sessions for root at that time, root's own 
systemd manager is started when the Cron job launches, and is stopped when 
the Cron job terminates. All of these log messages are related to this.

You may instead want to make root a lingering user:

    loginctl enable-linger root

This setting is persistent. You can use disable-linger at a later time to 
turn it off if necessary.

With root configured as a lingering user, its systemd manager remains 
running all the time.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux