{
    "content": [
        {
            "type": "text",
            "text": "# update-motd (man)\n\n## NAME\n\nupdate-motd - dynamic MOTD generation\n\n## SYNOPSIS\n\n/etc/update-motd.d/*\n\n## DESCRIPTION\n\nUNIX/Linux system adminstrators often communicate important information to console and remote\nusers by maintaining text in the file /etc/motd, which is displayed by the pammotd(8) module\non interactive shell logins.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **BEST PRACTICES**\n- **FILES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "update-motd",
        "section": "",
        "mode": "man",
        "summary": "update-motd - dynamic MOTD generation",
        "synopsis": "/etc/update-motd.d/*",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "motd",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/motd/5/json"
            },
            {
                "name": "pammotd",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/pammotd/8/json"
            },
            {
                "name": "run-parts",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/run-parts/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "BEST PRACTICES",
                "lines": 44,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 11,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "update-motd - dynamic MOTD generation\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "/etc/update-motd.d/*\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "UNIX/Linux system adminstrators often communicate important information to console and remote\nusers by maintaining text in the file /etc/motd, which is displayed by the pammotd(8) module\non interactive shell logins.\n\nTraditionally, this file is static text, typically installed by the distribution and only up‐\ndated on release upgrades, or overwritten by the local administrator with pertinent  informa‐\ntion.\n\nUbuntu  introduced  the  update-motd framework, by which the motd(5) is dynamically assembled\nfrom a collection of scripts at login.\n\nExecutable scripts in /etc/update-motd.d/* are executed by pammotd(8) as the  root  user  at\neach  login,  and this information is concatenated in /run/motd.dynamic.  The order of script\nexecution is determined by the run-parts(8) --lsbsysinit option (basically  alphabetical  or‐\nder, with a few caveats).\n\nOn Ubuntu systems, /etc/motd is typically a symbolic link to /run/motd.dynamic.\n\n",
                "subsections": []
            },
            "BEST PRACTICES": {
                "content": "MOTD  fragments  must be scripts in /etc/update-motd.d, must be executable, and must emit in‐\nformation on standard out.\n\nScripts should be named named NN-xxxxxx where NN is a two digit number indicating their posi‐\ntion in the MOTD, and xxxxxx is an appropriate name for the script.\n\nScripts must not have filename extensions, per run-parts(8) --lsbsysinit instructions.\n\nPackages  should  add scripts directly into /etc/update-motd.d, rather than symlinks to other\nscripts, such that administrators can modify or remove these scripts and  upgrades  will  not\nwipe  the  local changes.  Consider using a simple shell script that simply calls exec on the\nexternal utility.\n\nLong running operations (such as network calls) or resource intensive  scripts  should  cache\noutput, and only update that output if it is deemed expired.  For instance:\n\n/etc/update-motd.d/50-news\n#!/bin/sh\nout=/run/foo\nscript=\"w3m -dump http://news.google.com/\"\nif [ -f \"$out\" ]; then\n# Output exists, print it\necho\ncat \"$out\"\n# See if it's expired, and background update\nlastrun=$(stat -c %Y \"$out\") || lastrun=0\nexpiration=$(expr $lastrun + 86400)\nif [ $(date +%s) -ge $expiration ]; then\n$script > \"$out\" &\nfi\nelse\n# No cache at all, so update in the background\n$script > \"$out\" &\nfi\n\nScripts  should  emit  a blank line before output, and end with a newline character.  For in‐\nstance:\n\n/etc/update-motd/05-lsb-release\n#!/bin/sh\necho\nlsb-release -a\n\n",
                "subsections": []
            },
            "FILES": {
                "content": "/etc/motd, /run/motd.dynamic, /etc/update-motd.d\n\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "motd(5), pammotd(8), run-parts(8)\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "This manpage and the update-motd framework was written by Dustin  Kirkland  <kirkland@canoni‐\ncal.com> for Ubuntu systems (but may be used by others).  Permission is granted to copy, dis‐\ntribute and/or modify this document under the terms of the GNU General Public  License,  Ver‐\nsion 3 published by the Free Software Foundation.\n\nOn  Debian  systems,  the  complete  text  of  the GNU General Public License can be found in\n/usr/share/common-licenses/GPL.\n\n\n\nupdate-motd                                 13 April 2010                             update-motd(5)",
                "subsections": []
            }
        }
    }
}