From owner-freebsd-hackers Mon Jun 11 2:29:22 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from tele-post-20.mail.demon.net (tele-post-20.mail.demon.net [194.217.242.20]) by hub.freebsd.org (Postfix) with ESMTP id 4AB3537B405 for ; Mon, 11 Jun 2001 02:29:15 -0700 (PDT) (envelope-from m.seaman@plasm.demon.co.uk) Received: from plasm.demon.co.uk ([194.222.58.229]) by tele-post-20.mail.demon.net with esmtp (Exim 2.12 #2) id 159O0X-000Oq9-0K for freebsd-hackers@freebsd.org; Mon, 11 Jun 2001 09:29:14 +0000 Received: (from matthew@localhost) by plasm.demon.co.uk (8.11.3/8.11.3) id f5B9SwQ26245 for freebsd-hackers@freebsd.org; Mon, 11 Jun 2001 10:28:58 +0100 (BST) (envelope-from matthew) Date: Mon, 11 Jun 2001 10:28:30 +0100 From: Matthew Seaman To: freebsd-hackers@freebsd.org Subject: Perl module for periodic scripts Message-ID: <20010611102830.A26191@plasm.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dear all, I've slung together a tiny little perl module to enable periodic(8) scripts to access periodic.conf(5) settings without having to use sh(1). I thought it might be useful to some, so I tidied it up and made it available for download at: http://www.plasm.demon.co.uk/FreeBSD-Periodic-0.1.tar.gz This all came about when I foolishly started porting some of the periodic scripts over to a Solaris8 box. Particularly 470.status-named. Solaris `date' doesn't support the `-v' flag, so: date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/' becomes perl -MPOSIX "print strftime "%b %e", localtime (time - 24 * 60 * 60);" and then Solaris `uniq' doesn't support the `-i' flag so: sort -f | uniq -ic | becomes: perl -ne '$s{lc $_}++; \ END { for (sort { $s{$a} cmp $s{$b} } keys %s) { \ printf "%4d $_", $s{$_} } }' by which time the script might just as well be pure perl anyhow... Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message