DBY
Who's Online
0 registered (), 7 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Latest Photo Gallery
light pole in the water
Eastern State Penitentiary - Philadelphia
Top Posters (30 Days)
HarryB 12
FinalDJ 11
Anartist 11
Goofy 6
m2h 3
Fitzy 3
firebane 1
bitstorm 1
Doorslammer 1
Dough 1
Topic Options
#851 - 07/01/01 09:22 AM ok any perl programers here?
Anonymous
Unregistered


I need a little help here is what i have so far works good
but trying to make it email the file lol
mysqldump -u dbuser -pdbuserpassword --opt dbname > /home/youraccount/dbbackup.sql
gzip /home/youraccount/dbbackup.sql
mv /home/youraccount/dbbackup.sql.gz /home/youraccount/dbbackup-`date +%m-%d-%Y`.sql.gz


now that makes the backupdatabase & gzips it now I added this for the email:
open(MAIL, "|/usr/lib/sendmail -t");

print MAIL "To: $sendToAddress\n";
print MAIL "From: $myEmailAddress\n";
print MAIL "Subject: $subject\n";

print MAIL "This is the message body.\n";
print MAIL "Put your message here in the body.\n";
$obj->Attach($file);
$obj->Attach($file, \$filedata);
$obj->Attach($file, \*FILEHANDLE);
close (MAIL);

now the only thing I see wrong is define how how the attactment is sent ACSII or binary
hummm damn it reseaching this is hard lol


Top
#852 - 07/01/01 02:28 PM Re: ok any perl programers here?
Anonymous
Unregistered


ok well did this I dumped the email part I used uptop
& put this code in place hehe I'm getting closer
code:--------------------------------------------------------------------------------
#!/usr/bin/perl

use MIME::Entity;

$message = "Message text here";
### Create the top-level, and set up the mail headers:
$top = MIME::Entity->build(Type =>"multipart/mixed",
From => "from\@yourdomain.com",
To => "to\@yourdomain.com",
Subject => "Your subject here");

$top->attach(Data=>$message);

### Part #2: a GIF file:
$top->attach(Path => "/path/to/file/to/attach.zip",
Type => "application/gzip",
Encoding => "binary");


### Send it:
open MAIL, "| /usr/lib/sendmail -t -oi -oem" or die "open: $!";
$top->print(\*MAIL);
close MAIL;

--------------------------------------------------------------------------------
only one more thing i'm not sure of & thats the file attachments name because it gets the date in the file name so every day it's different hummmm ...
not sure if I name the attachment like this if it would know to send the new file lol
dbbackup-`date +%m-%d-%Y`.sql.gz

anyway i'm closer to this yippy



Top



Moderator:  Doorslammer, Nightowl, NightShade, Rez 
Shout Box

Today's Birthdays
No Birthdays
May
Su M Tu W Th F Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31