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

FireMotD stuck on new php code #44

Closed ThomDietrich closed 7 years ago

ThomDietrich commented 7 years ago

After the latest change with https://github.com/willemdh/FireMotD/commit/b3e92aa2fab44928b534b6e9aced1c6a6b69ba9b FireMotD will get stuck on PhpMaxMemory=$(tac $PhpMaxMemory ... if PhpMaxMemory was not previously defined (none of the two above conditions were met). On our system no php.ini exists, The check should be skipped in this case.

As it is right now, FireMotD will hinder the user from logging in: https://community.openhab.org/t/openhabian-stuck-on-ssh-connection/28040

Possible fix:

if [ -n "$PhpMaxMemory" ] ; then
        PhpMaxMemory=$(tac $PhpMaxMemory | grep -F -m 1 memory_limit | sed -n 's/.* = \([0-9]*\)/\1/p' | sed 's/; .*//g')
fi

A quick fix would be highly appreciated, especially as many of our users are currently updating their installation... https://community.openhab.org/t/notice-to-all-openhabian-users-please-apply-a-fix-asap/27908/1

willemdh commented 7 years ago

@ThomDietrich Hmm in the past I had such an issue, entering Ctrl-C helped continuing the logon.

I added the PhpMaxMemory check as suggested by yourself. Can you check if it's ok now?

ThomDietrich commented 7 years ago

Pressing Ctrl+C helped. The problem is, that without a defined $PHPMaxMemory the command tac | ... will wait for stdin input, hence block the normal execution. The new code is working and also solves what I initially reported in #28 in a reasonable way. :+1: Thanks

ThomDietrich commented 7 years ago

Improvement proposed in #45