RE: Scripting Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: shrike-list-admin@xxxxxxxxxx 
> [mailto:shrike-list-admin@xxxxxxxxxx] On Behalf Of John Colville
> Sent: Wednesday, October 15, 2003 1:21 AM
> To: shrike-list@xxxxxxxxxx
> Subject: Re: Scripting Question
> 
> 
> Jake McHenry wrote:
> 
> > > -----Original Message-----
> > > From: shrike-list-admin@xxxxxxxxxx 
> > > [mailto:shrike-list-admin@xxxxxxxxxx] On Behalf Of Stephen Mah
> > > Sent: Tuesday, October 14, 2003 7:49 PM
> > > To: shrike-list@xxxxxxxxxx
> > > Subject: Re: Scripting Question
> > >
> > >
> > > you can probably use the find command, to find files that 
> are older 
> > > than 4 days. Use the -exec option to remove the file.
> > >
> > > Jake McHenry wrote:
> > > > Hi everyone,
> > > >
> > > > I made up a script that backs up my mysql database into a
> > > compressed
> > > > file. What I want to do now it make it only keep the 
> last 4 days, 
> > > > anything older than that it will delete, basically the 
> same thing 
> > > > logrotate does.
> > > >
> > > > Is there a way for me to do this in a bash script?
> > > >
> > > > The files are named: sql_10142003.sql.gz
> > > >
> > > > Jake McHenry
> > > > Nittany Travel MIS Coordinator http://www.nittanytravel.com
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Shrike-list mailing list
> > > Shrike-list@xxxxxxxxxx
> > > https://www.redhat.com/mailman/listinfo/shrike> -list
> > >
> >
> > Something like this?
> >
> > find /archive/backup/sql* -mtime 4 -exec rm -f -r
> >
> > That gives me an error: find: missing argument to `-exec'
> >
> > The man page isn't very good on find. It helped a lot, but 
> some of the
> > stuff is kinda fuzzy.
> >
> > Jake
> >
> 
> You need to add '{} \;' to the above to make it work I think.
> i.e.
> 
> find /archive/backup/sql* -mtime 4 -exec rm -f -r {} \;
> 
> Cheers,
> 
> John
> 
> >
> > --
> > Shrike-list mailing list
> > Shrike-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/shrike-list
> 
> 
> -- 
> Shrike-list mailing list
> Shrike-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/shrike-list
> 

Oh is that what they are? The fonts aren't displaying right in my man
pages, I have this for the characters: 

-exec command ;
              Execute  command;  true  if 0 status is returned.  All
following
              arguments to find are taken to be arguments to the
command until
              an  argument  consisting of �;’ is encountered.  The
string �{}’
              is replaced by the current file name being processed
everywhere
              it occurs in the arguments to the command, not just in
arguments
              where it is alone, as in some versions of find.  Both
of  these
              constructions might need to be escaped (with a �\’)
or quoted to
              protect them from expansion by the shell.  The command
is  exe-
              cuted in the starting directory.


It doesn't look that bad on here.. But on the console.. It's worse
than that..

Thanks for your help,

Jake


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux