Scripts and monitoring
simple-update --check reports the available updates without installing
anything and without root, so scripts and monitoring systems can use it.
Its output, its exit codes and its JSON format are
stable interfaces.
Checking for updates#
--check checks the way the notification timer does: on Debian and Ubuntu
it reads the package lists that apt-daily.timer keeps fresh, and on Arch
it uses checkupdates. It prints one available update per line,
name old -> new, with [flatpak] or [snap] after app updates:
linux 6.16.8.arch1-1 -> 6.16.10.arch1-1 org.gnome.Maps - -> 49.1 [flatpak]
Notes such as held-back changes or a pending restart go to stderr, so stdout holds only updates. A source turned off in Preferences is left out, and doesn't count as a failure.
Exit codes#
| Code | Meaning |
|---|---|
| 0 | Updates are available |
| 1 | A source could not be checked. The results from the others are still printed |
| 3 | No updates are available |
| 5 | An interrupted update requires repair, even if other checks failed |
Repair takes precedence over incomplete checks. For example, as a monitoring check:
simple-update --check > /dev/null 2>&1
case $? in
0) echo "WARNING: updates available" ;;
3) echo "OK" ;;
5) echo "CRITICAL: interrupted update needs repair" ;;
*) echo "UNKNOWN: check failed" ;;
esacJSON output#
--check --json prints one JSON object instead:
| Field | Type | Meaning |
|---|---|---|
version |
integer | Format, currently 1 |
updates |
list of objects | Available updates: name, old and new (strings, or null when unknown), source (apt, pacman, flatpak or snap), origin (the repository, Flatpak remote or Snap publisher, as display text, or null), security (boolean; from a security repository, apt only), and download and size_change (bytes to download and the change in installed size, negative when it shrinks, or null when unknown) |
held_back |
list of strings | Changes only a dist-upgrade makes (apt), as display text |
orphans |
list of strings | Packages nothing needs any more |
interrupted |
boolean | Whether the last update didn't finish |
reboot_required |
boolean | Whether a restart is pending |
reboot_reasons |
list of strings | Why, as display text: on Debian and Ubuntu, the packages that asked for it |
check_errors |
object | Failed source names mapped to error messages; successful sources still have results |
turned_off |
list of strings | Sources excluded by preferences |
space_unknown |
string or null | Why disk-space needs could not be estimated |
news |
list of objects | Arch only: news since the last full upgrade, with title, link and date (ISO 8601) |
As with the history format, new fields may appear without a version change, so ignore fields you don't know.
An incomplete check still prints the results it has, including as JSON, and exits with 1. Terminal mode can install the updates from the sources that were checked, but still exits with 1.
Installing from a script#
To install updates unattended, use simple-update --yes; see
Unattended runs. It starts the helper
with sudo, so the job needs to run as root or as a user sudo lets run
it.
View this page's source · Documentation for Simple Update 1.3.2