dynamic-motd icon indicating copy to clipboard operation
dynamic-motd copied to clipboard

Disable if already logged in.

Open domlat opened this issue 2 years ago • 4 comments

If I am opening a second terminal on to a machine I am usually in a hurry! I have created this as 00-setup-hush and so now it's only the first terminal that calls sysinfo etc.

#!/bin/bash echo "user1 user2" > /etc/update-motd.d/hushlogin who | cut -d ' ' -f 1 | sort | uniq >> /etc/update-motd.d/hushlogin

domlat avatar Feb 21 '23 20:02 domlat

Obvs "user1" might end up in hushlogin twice but it's good enough for our purposes.

domlat avatar Feb 21 '23 21:02 domlat

But the users will never be deleted from hushlogin file, unless manually deleted. Not a good thing.

ldidry avatar Feb 23 '23 09:02 ldidry

Hushlogin is recreated every time it's run. It works. On some machines I have echo -n "" > /etc/update-motd.d/hushlogin if there's no users I need / want to exclude.

domlat avatar Feb 23 '23 16:02 domlat

You’re right, I didn’t notice the only >.

ldidry avatar Feb 24 '23 08:02 ldidry