-
Notifications
You must be signed in to change notification settings - Fork 2
/
motd
executable file
·100 lines (83 loc) · 1.66 KB
/
motd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
#
# motd
#
# Fancy motd status inspired
# by /r/unixporn
#
# (c) 2018 Daniel Jankowski
# import the different modules
source modules/cpu.bash
source modules/docker.bash
source modules/filesystems.bash
source modules/hostname.bash
source modules/lastlogin.bash
source modules/memory.bash
source modules/ssl.bash
source modules/systemd-service.bash
source modules/updates.bash
# configure which services should be
# displayed with the systemd-service-module
SERVICES=(
"NetworkManager"
"firewalld"
)
# configure which filesystems
# shoudl be displayed with the
# filesystems-module
FILESYSTEMS=(
"/"
"/boot"
)
# configure which domains
# the ssl module should display
# the expiration of the Certificate
DOMAINS=(
"domain.com"
"example.com"
)
# configure for which users the last
# login should be displayed
USERS=(
"$USER"
"root"
)
# configure which containers should
# be checked in the docker-module
CONTAINER=(
"sql"
"sf.app"
)
# print the uptime
print_uptime() {
uptime -p
}
# main function and entrypoint of this script
# it runs the different functions from the modules
# and prints a newline in order to seperate the
# outputs.
main() {
print_hostname
printf "\n"
print_uptime
printf "\n"
print_filesystems
printf "\n"
print_systemd_services_status
printf "\n"
print_docker_status
printf "\n"
print_cpu_core_temperatures
printf "\n"
print_memory_status
printf "\n"
print_ssl_expire_date
printf "\n"
print_updates_arch
printf "\n"
print_last_login
}
# fail fast
set -eo pipefail
# execute the main function with commandline arguments
main "$@"