summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-07-10 11:18:49 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-07-10 11:18:49 +0000
commit09335ba67ba3bbfd27d62d27f6238677a626453f (patch)
treeddcc8f1bcd54d842402b983f3895476dbbc16d0f
parent3890b3b1527f6a2660792312ee3b39de72999a04 (diff)
Test if an acct file exists before trying to rename it. This silences
false warnings in the frist three daily mails after process accounting has been turned on. from Raf Czlonka
-rw-r--r--etc/daily11
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/daily b/etc/daily
index 8d80fa0ccb2..25d489429b2 100644
--- a/etc/daily
+++ b/etc/daily
@@ -1,5 +1,5 @@
#
-# $OpenBSD: daily,v 1.89 2017/06/10 11:28:30 bluhm Exp $
+# $OpenBSD: daily,v 1.90 2017/07/10 11:18:48 bluhm Exp $
# From: @(#)daily 8.2 (Berkeley) 1/25/94
#
# For local additions, create the file /etc/daily.local.
@@ -66,9 +66,12 @@ fi
next_part "Purging accounting records:"
if [ -f /var/account/acct ]; then
- mv -f /var/account/acct.2 /var/account/acct.3
- mv -f /var/account/acct.1 /var/account/acct.2
- mv -f /var/account/acct.0 /var/account/acct.1
+ test -f /var/account/acct.2 && \
+ mv -f /var/account/acct.2 /var/account/acct.3
+ test -f /var/account/acct.1 && \
+ mv -f /var/account/acct.1 /var/account/acct.2
+ test -f /var/account/acct.0 && \
+ mv -f /var/account/acct.0 /var/account/acct.1
cp -f /var/account/acct /var/account/acct.0
sa -sq
lastcomm -f /var/account/acct.0 | grep -e ' -[A-Z]*[PT]'