Modular Message of the Day (motd) Script built on NeoFetch. With additional PUPPET and SYSTEMD plugins.
-
- 2.1. Built With
- 2.2. Installation
-
- 4.1. Adding Plugins
- 4.1.1. Filename
- 4.1.2. Your plugin
- 4.1.3. motd
- 4.1.4. Output
- 4.1.5. Custom Branding
- 4.1. Adding Plugins
This is a heavily cut-down and modularised version of NeoFetch https://github.com/dylanaraps/neofetch
Built to be customisable on the display with a plugin system.
The notable differences are as follows:
- Most functions are now in separate files in the
plugin
folder. Easier to read and debug. - Functions for formatting output are separate files in the
components
folder. - Additional custom PUPPET-based plugin for displaying lock messages, status, etc...
- Additional systemd plugin for displaying the status of services.
❯ motd
███████████████ ████████████████████████ ------------- Andys-MacBook-Air.local -------------
████████████████ ███████████████████████
█████████████████ ██████████████████████ HOST Andys-MacBook-Air.local
██████████████████ █████████████████████ OS macOS
███████████████████ ████████████████████ MODEL MacBookAir8,1
████████████████████ ███████████████████ LOCAL_IP 192.168.1.15
█████████████████████ ██████████████████ PUBLIC_IP 79.79.210.236
██████████████████████ █████████████████
███████████████████████ ████████████████ ---------------------- NODE ----------------------
████████████████████████ ███████████████
UPTIME -----------------------======== 156%
MEMORY ---------====== 10681MiB / 16384MiB (65%)
DISK -============== 14G / 466G (9%)
------------------ HELP COMMANDS ------------------
help List custom scripts.
cheat command cheatsheet.
----------------------- ◣◥ -----------------------
This project was built with the following frameworks, technologies and software.
These are the steps to get up and running.
- Clone the repo in home directory.
git clone https://github.com/IORoot/motd ~/motd
- Link.
ln -s ~/motd/motd /usr/local/bin/motd
- Add to your .bashrc / .zshrc file so it displays when you login.
echo "motd" >> ~/.bashrc
You can run the script whenever you like by using motd
on the command line.
If you wish to add a plugin, create a new file in the plugins
folder. The name of the file MUST be prefixed with get_
and the name of the function.
So, if you were creating a foobar
funciton, the name of the plugin file would be get_foobar
(with NO .sh
on the end)
Your plugin MUST have a function must be the same as the filename. get_foobar() { }
for instance.
Your plugin MUST return a variable called by the name of your function (e.g. $FOOBAR). You can add additional variables, but these will be used in the output later.
get_foobar() {
FOOBAR="This is FOOBARed!"
}
Next, within the motd
file, there is a plugins()
function with a PLUGINS
variable. Add your new plugin here at the bottom of the list. (Without the get_
prefix)
e.g.
PLUGINS=(
# Essentially Ordered Plugins.
"kernel" # KERNAL MUST BE FIRST PLUGIN. (OS Relies on it)
"os" # OS MUST BE THE SECOND PLUGIN. (Others rely on it)
# All other Plugins
"hostname"
"local_ip"
"public_ip"
"uptime"
"cpu_usage"
"memory"
"disk"
"model"
"systemctl:mysql"
"systemctl:php"
"systemctl:apache"
"systemctl:ssh"
"puppet"
"logo"
"foobar" # <------- Your New Plugin.
)
Lastly, Add your new plugin to one of the output sections at the bottom (or create your own)
They ustilise the row
function to display the output in columns.
So to display in the system section, you can add your function like so:
system()
{
# SYSTEM
printf "${LOGO}\n"
title "${HOSTNAME}"
row "HOST" "${HOSTNAME}" "APACHE" "${APACHE}" "UPTIME" "${CPU_USAGE}"
row "OS" "${OS}" "PHP" "${PHP}" "MEMORY" "${MEMORY}"
row "MODEL" "${MODEL}" "MySQL" "${MYSQL}" "DISK" "${DISK}"
row "LOCAL IP" "${LOCAL_IP}" "SSH" "${SSH}" "" ""
row "PUBLIC IP" "${PUBLIC_IP}"
row "FOOBAR" "${FOOBAR}"
}
Change the logo in the config.conf
file.
None
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License.
MIT License
Copyright (c) 2022 Andy Pearson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author Link: https://github.com/IORoot
v1.1.0 - Changed to using simple double columns. Basically the same as watch Neofetch originally did. Doh!
v1.0.0 - First version.