From owner-freebsd-questions@FreeBSD.ORG Fri Jan 14 18:46:06 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0B991065695 for ; Fri, 14 Jan 2011 18:46:06 +0000 (UTC) (envelope-from carlj@peak.org) Received: from redcondor1.peak.org (redcondor1.peak.org [69.59.192.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8F79E8FC0A for ; Fri, 14 Jan 2011 18:46:06 +0000 (UTC) Received: from peak-mail-gateway.peak.org ([69.59.192.41]) by redcondor1.peak.org ({e03e86cd-14ae-47ce-9578-3c080ce9c462}) via TCP (outbound) with ESMTP id 20110114184605417 for ; Fri, 14 Jan 2011 18:46:05 +0000 X-RC-FROM: X-RC-RCPT: Received: from oak.localnet (207.55.91.159.peak.org [207.55.91.159] (may be forged)) by peak-mail-gateway.peak.org (8.12.10/8.12.8) with ESMTP id p0EIk40p022250 for ; Fri, 14 Jan 2011 10:46:05 -0800 (PST) Received: from oak.localnet (localhost [127.0.0.1]) by oak.localnet (Postfix) with ESMTP id 808B2C77B for ; Fri, 14 Jan 2011 10:46:04 -0800 (PST) Received: (from carlj@localhost) by oak.localnet (8.14.4/8.14.4/Submit) id p0EIk49X058989; Fri, 14 Jan 2011 10:46:04 -0800 (PST) (envelope-from carlj@peak.org) X-Authentication-Warning: oak.localnet: carlj set sender to carlj@peak.org using -f From: Carl Johnson To: freebsd-questions@freebsd.org References: <4D2F606D.6090407@gmail.com> <20110113232321.5857ad0f@gumby.homeunix.com> <20110114153212.GA21418@libertas.local.camdensoftware.com> Date: Fri, 14 Jan 2011 10:46:04 -0800 In-Reply-To: <20110114153212.GA21418@libertas.local.camdensoftware.com> (Chip Camden's message of "Fri, 14 Jan 2011 07:32:13 -0800") Message-ID: <87sjwv2uj7.fsf@oak.localnet> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Date of a FreeBSD installation X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2011 18:46:06 -0000 Chip Camden writes: > Quoth Carl Chave on Friday, 14 January 2011: >> > I'd suggest looking at the Btimes of top level directories >> > >> > stat -f "%SB %N" /* >> >> Or how about just / as this ~15 minutes earlier than most of the >> remaining top level directories >> >> >> sodserve# stat -f "%SB %N" /* >> Jan 9 04:54:21 2011 /COPYRIGHT >> Jan 9 04:54:21 2011 /bin >> Jan 9 04:54:21 2011 /boot >> Dec 31 18:59:59 1969 /dev >> Jan 9 04:54:21 2011 /etc >> Jan 9 04:54:21 2011 /lib >> Jan 9 04:54:21 2011 /libexec >> Jan 9 04:54:21 2011 /media >> Jan 9 04:54:21 2011 /mnt >> Jan 9 04:54:21 2011 /proc >> Jan 9 04:54:21 2011 /rescue >> Jan 9 04:54:21 2011 /root >> Jan 9 04:54:21 2011 /sbin >> Jan 9 04:54:21 2011 /sys >> Jan 9 04:48:39 2011 /tmp >> Jan 9 04:48:45 2011 /usr >> Jan 9 04:49:39 2011 /var >> >> sodserve# stat -f "%SB %N" / >> Jan 9 04:39:59 2011 / > > For me, that gets the Nov 21 2009 date, which is earlier than my > install date. > > So far, /etc/hostid and the /home symlink seem to be the winners. On my system /etc/hostid is several days later than my actual install date, so that isn't always reliable. You might want to create a file with the timestamp you want. The most likely time appears to me to be the 'Created' time in /etc/rc.conf, as someone suggested earlier. The following code will extract that and create a file with that timestamp. I have checked it on my system, but use at your own risk. file=/etc/install_date date=$(grep '^# Created: ' /etc/rc.conf | cut -c 12-80) tdate=$(date -j -f "%a %b %d %H:%M:%S %Y" "$date" "+%Y%m%d%H%M.%S") echo $date > $file touch -t $tdate $file chmod -w $file chflags schange $file -- Carl Johnson carlj@peak.org