Execute at login

Helmut Schneider jumper99 at gmx.de
Mon Sep 26 20:41:58 UTC 2011


Hi,

which options do I have to execute at login?

I would like to implement something like update-motd [1] without
actually modifying /etc/motd. The code snippet is

if [ -d /etc/motd.d ]; then
  for FILE in /etc/motd.d/*; do
    [ -x ${FILE} ] && ${FILE}
  done
fi

It should be executed for all users but only at login (regardless if
she/he logs in via console or ssh). It also should be independent of
the login shell. Therefore neither /etc/profile nor ~/.profile nor
~/.login seem suitable.

Where can I put that code? The content of /etc/motd.d/ can change
anytime.

Thanks, Helmut

[1] https://wiki.ubuntu.com/UpdateMotd



More information about the freebsd-questions mailing list