Closed TexZeTech closed 1 year ago
@TexZeTech you mean to just output it on the screen, as if you just had logged in?
does the command run-parts /etc/update-motd.d
do what you expect?
If so, check the updated README on dev
branch: https://github.com/tomaski/klipper-motd/blob/dev/README.md#q-how-to-display-the-motd-at-will
run-parts /etc/update-motd.d
does work however it brings up Device "wlan0" does not exist.
before the motd. Other than that it works as intended. I will probably use what is suggested in the dev branch read me, Thanks again.
hmm that is weird. I have just installed MainsailOS on a reserve Pi 4b and that error does not appear. What I can think of, why you might be seeing it is that maybe you need to set the WiFi country to make it disappear. You can try editing the wifi config file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
and, depending how yours looks like, either uncomment (if present) or add country=
followed by 2 letter ISO code of your country.
I am not using WiFi and my entire wpa_supplicant.conf
looks like this
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL
TL;DR; Here is the work arround I'm using
ETH_IP=`/sbin/ip link show eth0 > /dev/null 2>&1 && /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1`
WLAN_IP=`/sbin/ip link show wlan0 > /dev/null 2>&1 && /sbin/ip -o -4 addr list wlan0 | awk '{print $4}' | cut -d/ -f1`
Mine didn't have the country variable but otherwise looked the same. I tried adding my iso, saved & rebooted but had the same result. I also am not using wifi on my Raspberry pi 2 B (literally no wifi)
looking at the file /etc/update-motd.d/10-klipper-motd
I modified your code to look like this
# get host information
ETH_IP=`/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1`
#WLAN_IP=`/sbin/ip -o -4 addr list wlan0 | awk '{print $4}' | cut -d/ -f1`
HOST_IP=""
HOST_NAME=`hostname -s`
# get load averages
IFS=" " read LOAD1 LOAD5 LOAD15 <<<$(cat /proc/loadavg | awk '{ print $1,$2,$3 }')
I think it's just erroring out on the fact that the pi 2B doesn't have wifi at all.
if I run ip -o -4 addr list wlan0
I get the result of Device "wlan0" does not exist.
& likewise, if I run ip -o -4 addr list eth0
I get a result of
2: eth0 inet ***.***.***.***/** brd ***.***.***.*** scope global dynamic noprefixroute eth0\ valid_lft 84511sec preferred_lft 73711sec
and If I only run ip -o -4 addr list
I get the loopback and the eth0.
Not a big deal one way or the other as I can remove that section and it works fine.
I have a workaround and because I don't script in bash all too often I tapped into my Bing skills and was rewarded with
WLAN_IP=`/sbin/ip link show wlan0 > /dev/null 2>&1 && /sbin/ip -o -4 addr list wlan0 | awk '{print $4}' | cut -d/ -f1`
ETH_IP=`/sbin/ip link show eth0 > /dev/null 2>&1 && /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1`
WLAN_IP=`/sbin/ip link show wlan0 > /dev/null 2>&1 && /sbin/ip -o -4 addr list wlan0 | awk '{print $4}' | cut -d/ -f1`
I will close this as I have it now working as needed. Thanks again for the great project.
As title says, I would like a command like motd or klipper-motd to bring it up after a command like clear or cd ect.