Re: Auto update

2010-04-13 Thread Jos Chrispijn
Thank you all for your kind replies; I will use the information as you 
suggested (including the -F :-)


regards,
Jos Chrispijn
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-12 Thread krad
On 11 April 2010 18:32, Randal L. Schwartz mer...@stonehenge.com wrote:

  Jos == Jos Chrispijn ker...@webrz.net writes:

 Jos In order to find out if someone logged in, I should then first copy
 auth.log
 Jos to auth2.log, and do a compare and then do the tail trick. Have to
 cron that
 Jos every half a minute.

 No, just track it with tail -f as was already suggested.

 tail -f /var/log/authlog | while read aline; do; ... ; done

 The code in the middle will get executed as each line appears in the
 file.  This even survives authlog renaming when you logroll.

 --
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
 See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
 discussion
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org


no use -F not -f as log rotation will break it otherwise
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread andrew clarke
On Sun 2010-04-11 08:14:48 UTC+0200, Jos Chrispijn (ker...@webrz.net) wrote:

 Can someone tell me if there is a way of generating an email on the
 moment that someone logs in to my FreeBSD server?

By which method?  SSH?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread Doug Hardie

On 10 April 2010, at 23:14, Jos Chrispijn wrote:

 Can someone tell me if there is a way of generating an email on the moment 
 that someone logs in to my FreeBSD server? The mail part (phpmail) will be 
 easy; I don't know yet how to trigger and pass parameter to this script or 
 redirect info to a file (that I then send by email).  Thanks.

A cheesy way to do that is to use a popen (tail -f /var/log/auth.log, r) 
and then read that.  It will give you every login regardless of ssh, telnet 
etc.  You could then generate the emails from that.  I have no idea just how 
resource intensive this might be.  You would also have to ensure it got started 
by rc during boot.___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread Jos Chrispijn


On 11-4-2010 8:27, andrew clarke wrote:

By which method?  SSH?
   


Yes, sorry I didn't mention that. If possible on both SSH and otherwise.

Thanks,
Jos
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread Jos Chrispijn


On 11-4-2010 9:41, Doug Hardie wrote:
A cheesy way to do that is to use a popen (tail -f 
/var/log/auth.log, r) and then read that. It will give you every 
login regardless of ssh, telnet etc. You could then generate the 
emails from that. I have no idea just how resource intensive this 
might be. You would also have to ensure it got started by rc during 
boot.___


In order to find out if someone logged in, I should then first copy 
auth.log to auth2.log, and do a compare and then do the tail trick. Have 
to cron that every half a minute.
I would like to know if there is something that is alterted on the 
moment that someone logs on thus forcing evt. your tail suggestion


thanks,
Jos Chrispijnj
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread Ed Jobs
On Sunday 11 of April 2010 12:32, Jos Chrispijn wrote:
 In order to find out if someone logged in, I should then first copy
 auth.log to auth2.log, and do a compare and then do the tail trick. Have
 to cron that every half a minute.
 I would like to know if there is something that is alterted on the
 moment that someone logs on thus forcing evt. your tail suggestion
 
 thanks,
 Jos Chrispijnj

you could try using syslog to do that. check the man page of syslog.conf, and 
search for auth. you could then populate a file with the successful logins 
as they happen

-- 
Real programmers don't document. If it was hard to write, it should be hard to 
understand.


signature.asc
Description: This is a digitally signed message part.


Re: Auto update

2010-04-11 Thread RW
On Sun, 11 Apr 2010 11:32:27 +0200
Jos Chrispijn ker...@webrz.net wrote:

 
 On 11-4-2010 9:41, Doug Hardie wrote:
  A cheesy way to do that is to use a popen (tail -f 
  /var/log/auth.log, r) and then read that. It will give you every 
  login regardless of ssh, telnet etc. You could then generate the 
  emails from that. I have no idea just how resource intensive this 
  might be. You would also have to ensure it got started by rc during 
  boot.___
 
 In order to find out if someone logged in, I should then first copy 
 auth.log to auth2.log, and do a compare and then do the tail trick.
 Have to cron that every half a minute.
 I would like to know if there is something that is alterted on the 
 moment that someone logs on thus forcing evt. your tail suggestion

tail -f *is* event driven. When a new line is appended to auth.log,
tail will output it.

You should probably use 

$ tail -F -n 0 /var/log/auth.log
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread krad
On 11 April 2010 08:41, Doug Hardie bc...@lafn.org wrote:


 On 10 April 2010, at 23:14, Jos Chrispijn wrote:

  Can someone tell me if there is a way of generating an email on the
 moment that someone logs in to my FreeBSD server? The mail part (phpmail)
 will be easy; I don't know yet how to trigger and pass parameter to this
 script or redirect info to a file (that I then send by email).  Thanks.

 A cheesy way to do that is to use a popen (tail -f /var/log/auth.log,
 r) and then read that.  It will give you every login regardless of ssh,
 telnet etc.  You could then generate the emails from that.  I have no idea
 just how resource intensive this might be.  You would also have to ensure it
 got started by rc during boot._


It shouldn't be to bad as I use that method to generate stats from log files
for snmp. The log files I tail have about 200 odd lines per second and the
boxes handle it fine. But they are decentish spec but not extravagant (dell
2850 with 4gig  ram)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread krad
 $ tail -F -n 0 /var/log/auth.log


Definitely use the -F rather than -f option as it will handle  log rotation
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Auto update

2010-04-11 Thread Randal L. Schwartz
 Jos == Jos Chrispijn ker...@webrz.net writes:

Jos In order to find out if someone logged in, I should then first copy 
auth.log
Jos to auth2.log, and do a compare and then do the tail trick. Have to cron 
that
Jos every half a minute.

No, just track it with tail -f as was already suggested.

tail -f /var/log/authlog | while read aline; do; ... ; done

The code in the middle will get executed as each line appears in the
file.  This even survives authlog renaming when you logroll.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org