Re: [OT] Re: email notifications when users login
On Thursday 21 September 2006 12:37 pm, Morgan Walker wrote:
> Thanks Michelle that worked perfect. Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?
$( date ) will add the current date and time. You can read the man page
for date to find out how to format it so that it only shows the date or
only the time or both, etc.
$( ) will start a sub-shell that runs whatever commands you put between
the $( and ).
So you could do:
msg="The user ${LOGNAME} has logged into $( hostname ) at $( date )."
echo $msg | sendmail -s "User login" some@email.net
--
Freddie Cash, LPIC-2 CCNT CCLP Network Support Technician
School District 73 (250) 377-HELP [377-4357]
fcash-ml@sd73.bc.ca
Reply to: