From nobody Wed May 15 20:04:04 2024 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vfkhj5fmMz4t0R4 for ; Wed, 15 May 2024 20:04:37 +0000 (UTC) (envelope-from arcadellama@posteo.net) Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vfkhj3M0Gz537f for ; Wed, 15 May 2024 20:04:37 +0000 (UTC) (envelope-from arcadellama@posteo.net) Authentication-Results: mx1.freebsd.org; none Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1501B240027 for ; Wed, 15 May 2024 22:04:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1715803474; bh=P4KuUKmlx1xiOvdOm4hpmacWsEutwhCVWgaRaPF13mA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=ReicK55cMYkHVeKJ0lyEzC9H0dteN4zqL/8MJ0i6dcltxrUYNNrVprYX/ctLIRLaM oFDNxIX+5eIYDQX7e4hXpj7jaZUfG+pVbZgoV4xgihTiMmWNJ31U2LRbtFu3koukrx chmOef/bStvoU60EScXljwfubp3y4cIaTyVFrJ8uaY15Pn00iPNqF8OH8xkE02M5xX AJ3zmBshLgva1MMb4uIyMbhwNC/gAt0oOkbGiaEN52n4xAkjWYc6KHN2VHhMkt8rob gDrMpzBMKuYQ7u0X2zpPXFNtrPmJQxPgytDI5c8xh3nt8uw8YvbvgS7k2whLRXnA+C a8Qyoeiki9uOw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Vfkhc4Lm9z6v0D; Wed, 15 May 2024 22:04:31 +0200 (CEST) From: Justin Teague To: "Dan Mahoney (Ports)" Cc: questions Subject: Re: EMail on unexpected reboot Date: Wed, 15 May 2024 20:04:04 +0000 Message-ID: <8C7E76F1-52EE-416E-AFBA-D9BADDC2A231@posteo.net> In-Reply-To: <9A12F675-BB12-4DD7-84D7-793FEFF63CCA@gushi.org> References: <83D445F4-677E-461F-B3FA-AA364B22C653@gushi.org> <9A12F675-BB12-4DD7-84D7-793FEFF63CCA@gushi.org> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:8495, ipnet:185.67.36.0/23, country:DE] X-Rspamd-Queue-Id: 4Vfkhj3M0Gz537f > On 15 May 2024, at 14:25, Dan Mahoney (Ports) wrote: > Yes, that happens *every* reboot, and I was asking if the system had a = way of detecting only =E2=80=9Cunclean=E2=80=9D reboots. Some checkfile = that=E2=80=99s set on clean shutdown, for example. I know that `last reboot` will show =E2=80=98boot=E2=80=99 and =E2=80=98s= hutdown=E2=80=99 entries the accounting database. I haven=E2=80=99t teste= d this myself, but I suppose an =E2=80=98unclean=E2=80=99 reboot would me= an you would have two consecutive =E2=80=98boot=E2=80=99 entries? (I=E2=80= =99m not in a place to test it at the moment.) If so, then something like the following should work: @reboot if [ =E2=80=9C$(last reboot | sed -n '2p' | cut -d ' ' -f1)=E2=80= =9D =3D =E2=80=9Cboot=E2=80=9D ]; then ; fi - Justin