Show system information at startup regardless of load

8,370

Solution 1

The Message of the day (MOTD) in Ubuntu is controlled by the directory /etc/update-motd.d/ (and the file /etc/update-motd, if any). Particularly, the Landscape info resides in the file /etc/update-motd.d/50-landscape-sysinfo, as simpoir mentioned in their answer.

On my Ubuntu 16.04, the file /etc/update-motd.d/50-landscape-sysinfo contains some entry settings and then an if block. So to display the information regardless of the condition, you can simply remove all contents except shebang and the if block contents. The result on my Ubuntu 16.04:

#!/bin/sh
echo
echo -n "  System information as of "
/bin/date
echo
/usr/bin/landscape-sysinfo

To do this, use the following procedure in the terminal:

cd /etc/update-motd.d                 # go to the right directory
sudo cp -L 50-landscape-sysinfo{,.bak}  # keep a backup copy: 50-landscape-sysinfo.bak
sudo nano 50-landscape-sysinfo        # edit the file contents using 'nano'
                                      # (or your favorite text editor)
                                      # and paste the above contents to it

What is meant by load higher than 1.0?

The load tells how much the hardware resources of your computer are being requested currently. As a rule of thumb, if it’s higher than your computer’s processor (core) count, the tasks get delayed. It’s OK to get the high-load MOTD message just after boot but if it keeps appearing for several days (MOTD may update just once a day), check whether your machine is powerful enough for the tasks it’s performing.

How to add/remove other commands to be run at cli login?

There are multiple ways and the right way depends on the purpose. You could simply add a script to the directory /etc/update-motd.d/ but it would be only run when the MOTD is updated.

Solution 2

The message you see on login are generated by motd. This specific one is defined in /etc/update-motd.d/50-landscape-sysinfo. To have it run regardless of load (which can make connecting through ssh unresponsive if the load is high), you can simply remove the condition from the file, which will then looks like such:

#!/bin/sh
echo
echo -n "  System information as of "
/bin/date
echo
/usr/bin/landscape-sysinfo

As for the load value, it represents load average, about which you can read more https://en.wikipedia.org/wiki/Load_(computing)

Share:
8,370

Related videos on Youtube

Varun Chhangani
Author by

Varun Chhangani

Knows C, C++, Python, JS and more I identify myself as a tinkerer College: IIIT Sri City

Updated on September 18, 2022

Comments

  • Varun Chhangani
    Varun Chhangani over 1 year

    When I ssh to my Ubuntu Server, I'm usually greeted with

    Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-45-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
     System information disabled due to load higher than 1.0
    
    
     * Canonical Livepatch is available for installation.
       - Reduce system reboots and improve kernel security. Activate at:
         https://ubuntu.com/livepatch
    
    0 packages can be updated.
    0 updates are security updates.
    
    

    here,

    System information disabled due to load higher than 1.0
    

    Conditionally according to load, runs landscape-sysinfo

      System information as of Tue Feb 19 04:22:46 UTC 2019
    
      System load:                    0.0
      Usage of /:                     60.2% of 19.78GB
      Memory usage:                   21%
      Swap usage:                     0%
      Processes:                      93
      Users logged in:                1
      IP address for enp0s3:          192.168.56.200
      IP address for enp0s8:          10.0.3.15
      IP address for docker_gwbridge: 172.18.0.1
      IP address for docker0:         172.17.0.1
    

    which I want to be shown unconditionally

    How to modify it how to ?

    Also, what is meant by load higher than 1.0 ?

    How to add/remove other commands to be run at cli login?

  • Varun Chhangani
    Varun Chhangani about 5 years
    Indeed, It is calling /etc/update-motd.d/50-landscape-sysinfo. But how to change what all things are ran as soon as user logs in? That is, from where is /etc/update-motd.d/50-landscape-sysinfo called so that we can change it to call directly landscape-sysinfo unconditionally. (Given the fact that /etc/update-motd.d/50-landscape-sysinfo calls landscape-sysinfo only if load less than 0)
  • Varun Chhangani
    Varun Chhangani about 5 years
    Adding script to /etc/update-motd.d/ worked
  • TonyG
    TonyG almost 4 years
    In Ubuntu 18 it doesn't look like the default installation incuded landscape-sysinfo, but v20 does. I noticed this when my upgraded 18>20 looked diffferent on login than my systems installed with v20. So it was required to install the landscape-common package as well as editing the script for this older single-CPU system. Since I'm here about motd and updates, the v20 update didn't change the update-motd.d folder. So I deleted all of the scripts and copied in those from a new v20 system. Bottom line, Question here was helpful, the answer by @Melebius was helpful, and I hope this addition is.
  • Melebius
    Melebius almost 4 years
    @TonyG Thanks for your addition. If you find a question and/or answer useful, please consider upvoting them to show their usefulness to others the intended way on this site.