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

Re: OT What would be the best script type



On Tue, 2004-06-29 at 13:06, slim wrote:
> On Tue, 2004-06-29 at 12:50, Reuben D. Budiardja wrote:
> > On Tuesday 29 June 2004 02:38 am, slim wrote:
> > > To do the following?
> > >
> > > I just got one of those fancy-dancy gmail accounts, and while I aint
> > > crazy about the email side of it, the one gig storage gave me an idea.
> > >
> > > what Id like to do, is make a script that will gather certain dir. and
> > > files for back up, split some tar.gz files at 9.8 meg each and email
> > > them to my gmail account... the gmail account has a 10 meg limit on a
> > > single message hence the need to split the file...
> > >
> > > I can think of a way to do this via php or perl but I was thinking a
> > > shell script would do it more efficiently... what do you all think?
> > 
> > That should not be too hard, certainly do-able with something like PHP. But in 
> > shell script, all you need would be the  following commands:
> > 
> > tar
> > gzip (maybe able to combine tar and gzip)
> > split 
> > mutt (to send file as attachment. I'm not sure if you can do it easily with 
> > 'mail').
> > 
> > You may need to loop over the resulting pieces file from split, then call 
> > 'mutt' inside the script.
> > 
> > I'd do it in PHP, since I know it better than shell (or bash), and just do 
> > system() or exex() for calling tar, gzip and split. Efficiency should not be 
> > a problem with PHP running in command line mode. 
> > 
> > RDB
> > -- 
> > Reuben D. Budiardja
> > Department of Physics and Astronomy
> > The University of Tennessee, Knoxville, TN
> > ---------------------------------------------------------
> > "To be a nemesis, you have to actively try to destroy 
> > something, don't you? Really, I'm not out to destroy 
> > Microsoft. That will just be a completely unintentional 
> > side effect."
> >                  - Linus Torvalds -
> > 
> 
> Yep I was looking at some ways in php to do this. but I cant get by
> the fact that I'll more than likely need two scripts.
> 
> one to do the backup, zip and split and one to retrieve the files and
> send via e-mail...
> 
> Thanks
> 
> 
I would expect that you would (for programming simplicity) need at least
2 scripts.  One that handles the creation / splitting, and one that is
called later with the number/names of the files created for sending.

One approach I would use would be similar to what mondoarchive does. 
Create fixed size (nearly) files on the fly while processing and then
you do not even need to do the split, but could pass the directory name
as an argument and simply send all in the directory  by mail.




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