Changing MOTD

I have 2 devices running CE - I ssh into both of them, but occasionally I have no idea which box I have connected to as the welcome screen is the same.

Is there a way to change this?

So I see CE1 and CE 2

Not a major issue but a nice to have.

You can change the device name in CoreELEC menu and when you ssh to the device that’s the name that appears in the ssh lines.

Yes I know that, but the question was about changing MOTD.

#CE1

is not as usable as
##############################################

CoreELEC

https://coreelec.org

##############################################
whereas
##############################################

CE2 *WARNING

Your running on CE2 development

##############################################
is a lot more noticible

It´s read only
File could be found here -> /etc/issue

But You can change the device name to find out to which box You are connected

I add some content to /storage/.profile script to achieve this.

case $- in
  *i*)
    # interactive session
    ;;
  *)
    ;;
esac

image

One other option is to mount bind some file over from autostart.sh

mount -o bind /storage/some_file.txt /etc/issue
2 Likes

Wow - thanks vpeter. That will work perfectly. Can you post the code you put in “interactive session” so I can replicate your output and then tweak it for my needs -it’s more useful now than just MOTD. Guess I was looking in the wrong direction.

My .profile is below. It shows some data on login, save last working folder when session is closed and then this folder is changed to on login, it saves command line history if window is closed.

alias  l='ls -al'
alias ll='ls -al'
alias lh='ls -alh'
alias cmdline="cat /proc/cmdline | tr ' ' '\n' | sed '/^[[:space:]]*$/d'"

export PATH=$PATH:/storage/downloads/bin

case $- in
  *i*)
    func_exit() {
      pwd >/storage/.last_dir
      sync
    }

    trap func_exit EXIT SIGHUP

    if [ -f /storage/.last_dir ]; then
      last_dir="$(cat /storage/.last_dir)"
      [ -d "$last_dir" ] && cd "$last_dir"

      [ "$(pwd)" = "/storage/.update" ] && cd /storage/downloads
      [ "$(pwd)" = "/storage" ]         && cd /storage/downloads
      [ "$(pwd)" = "/flash" ]           && cd /storage/downloads
    fi

    echo
    echo -n "CPU temp: " && cputemp
    echo

    governor0=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | tr -d '\n')
    governor4=$(cat /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor | tr -d '\n')
    f0=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
    f4=$(cat /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq)
    f0=$(($f0 / 1000 ))
    f4=$(($f4 / 1000 ))
    [ $f0 -lt 1000 ] && f0=" $f0"
    [ $f4 -lt 1000 ] && f4=" $f4"

    echo "SoC governor:  CPU 0: $governor0, $f0 MHz"
    echo "               CPU 4: $governor4, $f4 MHz"
    echo
    ;;
  *)
    ;;
esac

Many thanks vpeter - top :dog2:

1 Like