OutsideIT / FireMotD

:fire: Fire Framework Linux MoTD Generator :fire:
https://outsideit.net/firemotd
GNU General Public License v3.0
174 stars 45 forks source link

Session Counter not working on RPi #37

Closed ThomDietrich closed 6 years ago

ThomDietrich commented 7 years ago

This is related to the last two commits. I'm currently just seeing

Sessions = pi@

I'll provide a PR as soon as I found the time to look into this.

willemdh commented 7 years ago

We could do sth like:

SessionCount="$(who | cut -d' ' -f1,12 | tr ' ' @ | tr '\n' ',' | tr -d '()' | rev | cut -c 2- | rev)"
if ! ContainsValidIp $SessionCount ; then
    SessionCount="$(who | cut -d' ' -f1,13 | tr ' ' @ | tr '\n' ',' | tr -d '()' | rev | cut -c 2- | rev)"
fi
if ! ContainsValidIp $SessionCount ; then
    SessionCount="$(who | grep -c "$USER") sessions"
fi
willemdh commented 7 years ago

Seems it doesn't work properly on Centos 6 too. Looking into it. Seems like the cut needs f1,16 for CentOS 6... Will test and update this soon

willemdh commented 7 years ago

Reverted this change for now, made a test function. This is getting more complicated then I thought. Although it is a nice to have it will have to wait for some other changes.

ThomDietrich commented 7 years ago

Tested and working on RPi. Issue can be closed if you are seeing good results on Centos ;)

dimon222 commented 6 years ago

Is it resolved?

willemdh commented 6 years ago

For me it works fine, so I'm closing this for now. If it gives issues for you, let me know and I'll reopen.