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
1 Like

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.

func_exit() {
  pwd >/storage/.storepwd
  sync
}

trap func_exit EXIT SIGHUP

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*)
    if [ -f /storage/.storepwd ]; then
      cd "$(cat /storage/.storepwd)" &>/dev/null

      [ "$(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 ))

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

Many thanks vpeter - top :dog2:

1 Like