{ 6 comments… read them below or add one }

1 jamshid 02.22.07 at 11:29 am

On my FC5 system instead of
last reboot | head -1
I can type
last reboot -1

2 diana 10.15.07 at 12:57 pm

i couldn’t find out the error. please help me.

#Send list of users logged on to server via email
59 11 * * * last | grep date ‘+%a %b %d’ > /tmp/users.out ; mail -s “Users Logged Today” ephrondiana@gmail.com

when i tried to execute,
$ last |grep date ‘+%a %b %d’
i got no such file or directory error.

3 vivek 10.15.07 at 1:06 pm

Should be..

59 11 * * * last | grep $(date '+%a %b %d') > /tmp/users.out ; mail -s “Users Logged"
4 diana 10.15.07 at 1:25 pm

thanks a lot vivek.i din’t expect this much fast reply.But unfortunately when i execute,
$ last | grep $(date ‘+%a %b %d’)
i couldn’t get anything.Please help

5 vivek 10.15.07 at 2:12 pm

My bad…I forgot to include double quote …

59 11 * * * last | grep "$(date '+%a %b %d')" > /tmp/users.out ; mail -s “Users Logged"

Also you may wanna try out:

last -t yyyymmddhhmmss

HTH

6 diana 10.16.07 at 3:45 am

Thanks vivek.its working great…..

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , , , , , , ,

Previous post: Routing all mail to unknown users to a single mail account

Next post: Linux set default password expiry for all new users