

rust-motd Setup
source link: https://ttys3.dev/post/rust-motd-setup/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

rust-motd Setup
2022-01-05
:: 荒野無燈
:: Mod 2022-03-04(025b313)
2022-03-04 update:
gdm 用户最好不要启用 motd. 否则在登录界面会卡很久才进去.
有办法可以禁用这一行为, see https://bbs.archlinux.org/viewtopic.php?pid=1684018#p1684018
moving the following line:
session optional pam_motd.so motd=/etc/motd
from /etc/pam.d/system-login
to /etc/pam.d/sshd
.
The result is that the motd is no longer displayed in gdm, but it’s still displayed when logging in through ssh.
-——————————————————————————-
https://github.com/rust-motd/rust-motd
Beautiful, useful, configurable MOTD generation with zero runtime dependencies
如果显示 hostname 时想使用 figlet 的话需要安装一下:
paru -S figlet
the oneshot service
cat <<EOF > /etc/systemd/system/rust-motd.service
[Unit]
Description=run rust-motd
Wants=network-online.target
After=network-online.target
[Service]
Restart=on-failure
TimeoutStopSec=5
StandardOutput=file:/etc/motd
ExecStart=rust-motd /root/.config/rust-motd/config.toml
Type=oneshot
[Install]
WantedBy=default.target
EOF
the timer:
cat <<EOF > /etc/systemd/system/rust-motd.timer
[Unit]
Description=Run rust-motd every 5 minutes and on boot
[Timer]
OnBootSec=30s
OnUnitActiveSec=5min
[Install]
WantedBy=timers.target
EOF
the config:
注意替换配置中的 Your-Location-Here
为你的实际城市名(英文).
替换 user001
为你自己的用户名.
cat <<EOF > /root/.config/rust-motd/config.toml
[global]
progress_full_character = "="
progress_empty_character = "="
progress_prefix = "["
progress_suffix = "]"
time_format = "%Y-%m-%d %H:%M:%S"
[banner]
color = "red"
command = "hostname | figlet -f slant"
# if you don't want a dependency on figlet, you can generate your
# banner however you want, put it in a file, and then use something like:
# command = "cat banner.txt"
[weather]
url = "https://wttr.in/Your-Location-Here?0"
proxy = "http://127.0.0.1:7890"
# [service_status]
# Accounts = "accounts-daemon"
# Cron = "cron"
[docker_status]
# Local containers MUST start with a slash
# https://github.com/moby/moby/issues/6705
#"/nextcloud-nextcloud-mariadb-1" = "Nextcloud Database"
[uptime]
prefix = "Up"
[user_service_status]
clash = "clash"
systemd-resolved = "systemd-resolved"
gpg-agent = "gpg-agent"
# [ssl_certificates]
# sort_method = "manual"
#
# [ssl_certificates.certs]
# CertName1 = "/path/to/cert1.pem"
# CertName2 = "/path/to/cert2.pem"
[filesystems]
root = "/"
home = "/home"
[memory]
swap_pos = "beside" # or "below" or "none"
# [fail_2_ban]
# jails = ["sshd", "anotherjail"]
[last_login]
root = 2
user001 = 1
[last_run]
EOF
enable:
sudo systemctl enable --now rust-motd.timer
Recommend
-
107
WARNING homebrew has removed PHP 5.6 and this guide needs to be updated PHP Development on MacOs High Sierra This guide will get your machine ready for web development using PHP, Apache, and XDebug. As a consequence we wil...
-
125
I decided to surrender to my sacrilegous self and try to emulate everything I do with Vim from an empty Emacs config file built with Org-mode
-
99
I have been using Sublime Text for coding in PHP for several months now and over that time have accumulated several useful plugins and editor settings. I have not seen many recent articles about…
-
10
Logins failed when /etc/motd grew too big My school got into the whole networking thing rather early. It had a bunch of coaxial cable run through the tunnels between buildings. It would surface just long enough to make a stop at...
-
20
Software Setup¶ We are taking a practical approach in t...
-
7
Building a Web Application with Rust - Part II - Database Setup169 views•Jun 15, 2021 ...
-
5
0:00 / 14:33 ...
-
8
URL Shortener (2 Part Series) In this series of posts, I aim to guide you through the process of creating and deploying a public API. Over the course of the se...
-
7
There’s a tweet going around in the last few days that highlights that Ubuntu’s default MOTD (Message of the Day) fetches information from an Ubuntu server. In the pr...
-
3
<?xml encoding="utf-8" ??>Introduction When you log on to a Linux system, you're presented with a Message of the Day (MOTD). In early versions, this was a static message, read from a single file...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK