[TriLUG] Some script help

William Sutton via TriLUG trilug at trilug.org
Fri May 8 11:14:27 EDT 2015


If he sticks to bash, it comes preinstalled without any extra dependencies 
(and I say that as a perl guy).  If you keep the date in YYYYMMDD order, 
you don't need to do date conversion and comparison, because the dates 
sort numerically in the correct order.  This doesn't need to be a complex 
program written in a higher level language.

William Sutton

On Fri, 8 May 2015, Igor Partola via TriLUG wrote:

> +1 for not doing this in bash. While it's of course possible, Python would
> be my choice. There you can compare dates as dates, not as sorted strings.
>
> Another approach: use logrotate to do this. I have seen this used
> successfully to take backups from MySQL and keeping X number of days' worth
> of backups.
>
> Third approach: forget copying "today's file" and copy the latest file. Use
> `ls backup_*.tgz | sort | tail -n 1` to get the latest file.
>
> Fourth approach: use rsync and copy everything. Combine with third approach
> to first delete the local backups that are older than 7 days.
>
> Igor
> -- 
> This message was sent to: William <william at trilug.org>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web	: http://www.trilug.org/mailman/options/trilug/william%40trilug.org
> Welcome to TriLUG: http://trilug.org/welcome


More information about the TriLUG mailing list