dynamic-motd icon indicating copy to clipboard operation
dynamic-motd copied to clipboard

Refactor sysinfo

Open seven-beep opened this issue 1 year ago • 3 comments

Sorry, but could you rebase your modifications on the main branch?

Here we go :)

original message:

I am not sure all will interest you but I have passed a few hours to refactor the sysinfo python script for my own usage :

  • use python3
  • dropped utmp for a more trivial output with the command "who"
  • use the findmnt command to filter the mounts and produce a more compact output
  • added error handling on theses statfs calls
  • restored the ip of the main interface
  • use a main function

seven-beep avatar Sep 06 '24 08:09 seven-beep

To be honest, I don’t like displaying the IP address in the banner. You choose to display only one IP address into the many possibles (it may not suite all users) and ip route list dev won’t work on IPv6-only machines.

And I prefer having multiple login showing, with their IP address and time, as:

  • it allows me to know if I’m already logged
  • it allows me to see all the IP addresses of those connections (better for security)
  • if a co-worker has an old session on the server, I can ask them if it’s on purpose or if they can logout, allowing me, for ex., to reboot the server

We may have a config file to change the behavior of the script, like the hushlogin file.

ldidry avatar Nov 26 '24 09:11 ldidry

Luc Didry @.***> writes:

To be honest, I don’t like displaying the IP address in the banner. You choose to display only one IP address into the many possibles (it may not suite all users) and ip route list dev won’t work on IPv6-only machines.

And I prefer having multiple login showing, with their IP address and time, as:

• it allows me to know if I’m already logged • it allows me to see all the IP addresses of those connections (better for security) • if a co-worker has an old session on the server, I can ask them if it’s on purpose or if they can logout, allowing me, for ex., to reboot the server

We may have a config file to change the behavior of the script, like the hushlogin file.

That is fair, give me some time to address it.

Concerning the findmnt command, I choose the '--fstab' flag because I want to keep the output terse by eg, not displaying all bind mount that can be generated by docker or other software.

I can also revise that and/or address it via configurations options.

seven-beep avatar Dec 02 '24 18:12 seven-beep

Hello @ldidry,

Finally after following your indication, this pull request become mainly about using findmnt to construct a more compact view of the filesystems.

What do you think ?

seven-beep avatar Jan 28 '25 20:01 seven-beep