Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2001 10:28:30 +0100
From:      Matthew Seaman <m.seaman@plasm.demon.co.uk>
To:        freebsd-hackers@freebsd.org
Subject:   Perl module for periodic scripts
Message-ID:  <20010611102830.A26191@plasm.demon.co.uk>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010611102830.A26191>