Führen Sie jedes Mal ein TTY-Skript aus, wenn ich ein GUI-Terminal öffne

Führen Sie jedes Mal ein TTY-Skript aus, wenn ich ein GUI-Terminal öffne

Wenn ich mich bei einem TTY anmelde, erhalte ich den folgenden netten Text:

Ubuntu 16.04.03 LTS
Log-in: username
Password:
Last log-in date/time
Welcome to Ubuntu 16.04.03 LTS

 * Documentation:
 * Management:
 * Support:

9 packages to update
4 updates are security updates

Ich möchte, dass die letzten beiden Zeilen jedes Mal wiederholt werden, wenn ich ein GUI-Terminal für alle Benutzer in der admGruppe öffne (aber ich bin damit zufrieden, dass jedes Mal, wenn ich ein GUI-Terminal für alle Benutzer öffne, die gesamte Anzeige angezeigt wird).

Ich habe das Naheliegende versucht:

fab-root@fab-ux-predator:~
$ cd /etc/update-motd.d/
fab-root@fab-ux-predator:/etc/update-motd.d
$ ./90-updates-available 
fab-root@fab-ux-predator:/etc/update-motd.d
$ cat /var/lib/update-notifier/updates-available
cat: /var/lib/update-notifier/updates-available: Permission denied
fab-root@fab-ux-predator:/etc/update-motd.d
$

Was vermisse ich?

PS: Natürlich kann ich chmod o+rdie Datei, aber wie zukunftssicher wäre das?

Antwort1

Es ist etwas langsam, aber es generiert die Paket-/Update-Informationen. Hängen Sie dies an die Benutzerdatei an .bashrc:

/usr/lib/update-notifier/apt-check --human-readable

Antwort2

Die gesamte Ausgabe befindet sich in /run/motd.dynamic:

$ grep motd /etc/pam.d -R
/etc/pam.d/sshd:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/sshd:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/sshd:session    optional     pam_motd.so  motd=/run/motd.dynamic
/etc/pam.d/sshd:session    optional     pam_motd.so noupdate
/etc/pam.d/login:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/login:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/login:session    optional   pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/login:session    optional   pam_motd.so noupdate

.bashrcSie könnten in Ihrem also Folgendes anhängen:

[[ -r /run/motd.dynamic ]] && cat /run/motd.dynamic

Oder:

[[ -r /run/motd.dynamic ]] && grep update /run/motd.dynamic

verwandte Informationen