[NTLUG:Discuss] Script question

sysmail@glade.net sysmail at glade.net
Sat Jan 5 14:02:29 CST 2002


Wouldn't logrotate do all this a lot easier?

Just a thought,

Carl

On Fri, 4 Jan 2002, Paul Ingendorf wrote:

> Date: Fri, 4 Jan 2002 23:40:18 -0600
> From: Paul Ingendorf <pauldy at wantek.net>
> Reply-To: discuss at ntlug.org
> To: discuss at ntlug.org
> Subject: RE: [NTLUG:Discuss] Script question
>
> hmm shell scripts yum gotta throw in how I would do it even though I see a few fine examples have already been posted.
> The following would also move the files appropriately.  Just copy and paste this in a file chmod +x it and remember to create the new backup file as /archive/domains.`date +%Y-%m-%d` and it should work properly every time.
>
> #!/bin/bash
> rm -f /archive/*.3
> let x=3
> for file in /archive/domains.[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9].[0-3]
> 	do
> 		mv $file /archive/`echo $file | sed -e "s/\.[0-9]^//g"`.$x
> 		let x=$x-1
> 	done
> mv /archive/domains.`date +%Y-%m-%d` /archive/`date +%Y-%m-%d`.0
>
>





More information about the Discuss mailing list