The easy way to keep a week's worth of somethingAs an example, say that you want to keep a week's worth of backups from
your PostgreSQL database. The Simple: use GNU DAY=$(date +%a) pg_dump >db-back.$DAY (I admit that I tend to use This has the great virtue that you don't need to write (or reuse) any code at all to age things; you get aging for free, at the cost of the most recent version not always having the same name. This works equally well if you want to keep seven days worth of a
collection of things; just put them in subdirectories named after
the day. You can adopt it for other intervals that (Attempts to take day of the year mod something are coercing this trick further than it should be pushed. And if you do hours, don't forget the effects of going into and out of daylight savings time (if you do).) (2 comments.)
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |