On Thu, Apr 05, 2001 at 04:43:46PM -0700, Jason E. Stewart wrote: > "Kevin van Haaren" <[EMAIL PROTECTED]> writes: > > > At 4:28 PM -0700 4/5/01, Jason E. Stewart wrote: > > what about an init script that runs just after the network is up, but > > before postgres, that checks the date and if it's < 2001 force it to > > 1/1/2001 then run ntpdate to get the real date? > > Hmmm... it might work. The issue is, I'm not sure if Pg is getting > borked because: > 1) it's seeing a date prior to epoch > 2) it's seeing an out of order date... > > Your idea would work if 1) not if 2)
if combined with ntpdate it would work for either. that requires network connectivity however. > Probably the Pg init script should just check the date and if it's > wrong, refuse to start Pg with a big nasty error msg. that would be rather easy, in the stop section of the initscript it could save the current time, and then in the start section check that the current time is greater then that saved: stop) date +%s > /var/lib/postgres/lasttime ;; start) if [ `date +%s` -lt `cat /var/lib/postgres/lasttime` ] ; then echo 1>&2 "WARNING: clock skew, not starting postgresql" exit 1 fi /var/lib/postgres may not be a safe place for that file, only root should be able to write whereever the file is kept. and this will only work with GNU date since %s is a GNU extension, no problem for debian but you can't use the same method on a BSD box. -- Ethan Benson http://www.alaska.net/~erbenson/
pgpQDJvWKdjib.pgp
Description: PGP signature