DNF Automatic

Synopsis

dnf-automatic [<config file>]

Description

Alternative CLI to dnf upgrade with specific facilities to make it suitable to be executed automatically and regularly from systemd timers, cron jobs and similar.

The operation of the tool is completely controlled by the configuration file and the command only accepts single optional argument pointing to it. If no configuration file is passed from the command line, /etc/dnf/automatic.conf is used.

The tool synchronizes package metadata as needed and then checks for updates available for the given system and then either exits, downloads the packages or downloads and applies the packages. The outcome of the operation is then reported by a selected mechanism, for instance via the standard output, email or motd messages.

A few default systemd units are provided to enable some standard configurations:

  • dnf-automatic-notifyonly
  • dnf-automatic-download
  • dnf-automatic-install

Run dnf-automatic

You can select on that most closely fits your needs, customize /etc/dnf/automatic.conf for any specific behaviors, and enable the timer unit.

For example:systemctl enable dnf-automatic-notifyonly.timer && systemctl start dnf-automatic-notifyonly.timer

Configuration File Format

The configuration file is separated into topical sections.

[commands] section

Setting the mode of operation of the program.

apply_updates

boolean, default: False

Whether packages comprising the available should be applied (i.e. installed via RPM). Implies download_updates. Note that if this is set to False, downloaded packages will be left in the cache to the next successful DNF transaction.

download_updates

boolean, default: False

Whether packages comprising the available should be downloaded.

upgrade_type

either one of default, security, default: default

What kind of upgrades to look at. default signals looking for all available updates, security only those with an issued security advisory.

random_sleep

time in seconds, default: 300

Maximal random delay before downloading.

[emitters] section

Choosing how the results should be reported.

emit_via

list, default: email, stdio, motd

List of emitters to report the results through. Available emitters are stdio to print the result to standard output, command to send the result to a custom command, command_email to send an email using a command, and email to send the report via email and motd sends the result to /etc/motd file.

system_name

string, default: hostname of the given system

How the system is called in the reports.

[command] section

The command emitter configuration. Variables useable in format string arguments are body with the message body.

command_format

format string, default: cat

The shell command to execute.

stdin_format

format string, default: {body}

The data to pass to the command on stdin.

[command_email] section

The command email emitter configuration. Variables useable in format string arguments are body with message body, subject with email subject, email_from with the “From:” address and email_to with a space-separated list of recipients.

command_format

format string, default: mail -s {subject} -r {email_from} {email_to}

The shell command to execute.

stdin_format

format string, default: {body}

The data to pass to the command on stdin.

email_from

string, default: root

Message’s “From:” address.

email_to

list, default: root

List of recipients of the message.

[email] section

The email emitter configuration.

email_from

string, default: root

Message’s “From:” address.

email_to

list, default: root

List of recipients of the message.

email_host

string, default: localhost

Hostname of the SMTP server used to send the message.

[base] section

Can be used to override settings from DNF’s main configuration file. See DNF Configuration Reference.