Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor sysinfo #12

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Refactor sysinfo #12

wants to merge 12 commits into from

Conversation

seven-beep
Copy link

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

@@ -55,7 +55,7 @@ sudo apt install ./dynamic-motd_*.deb
You need to install some packages:

```
apt-get install figlet lsb-release python3-utmp bc
apt-get install figlet lsb-release bc
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findmnt is in util-linux, could you add it, please?

"--noheading",
"--real",
"--uniq",
"--fstab",
Copy link
Owner

@ldidry ldidry Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With --fstab, you won’t show disks mounted with systemd mount units.

@ldidry
Copy link
Owner

ldidry commented Nov 26, 2024

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.

@seven-beep
Copy link
Author

seven-beep commented Dec 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants