LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-17-2010, 06:02 AM   #1
gamorgan
LQ Newbie
 
Registered: Dec 2010
Posts: 12

Rep: Reputation: 0
Command line sending of mail attachments ( DB backups)


Hello all

I'm am not remotely familiar with the linux operating sytem and just need a simple 'cut and paste solution' that will allow me to send .gz files as mail attachments, from the command line.

Recently I moved my website to new hosting company, they are using cpanel and I have set up a couple of commands; the cpanel scheduler runs them for me as required.

1. creates an mysql dump and saves it to folder ( in root of my space ). Works fine.

2. delete the file created above, after 15 mins. Also works fine

What I really want to do is email the .gz to myself before it is deleted, this is were I am stuck.
This is possible ( I believe ) but it is beyond my understanding and ability to write the script/command that will make this happen.

Please make any instructions really simple and clear as I am really new to this.

Any help would be very much appreciated.

There are several Pearl and PHP modules installed on the server and this information is provided below and may be helpful to you (but I certainly to not know anything about this type of stuff).


More info about the server to come.

Last edited by gamorgan; 12-17-2010 at 06:27 AM.
 
Old 12-17-2010, 06:14 AM   #2
gamorgan
LQ Newbie
 
Registered: Dec 2010
Posts: 12

Original Poster
Rep: Reputation: 0
modules on the server that I thought were relevant. There are a great many more.


Mail::Address
Mail::Cap
Mail::Field
Mail::Field::AddrList
Mail::Field:: Date
Mail::Field::Generic
Mail::Filter
Mail::Header
Mail::Internet
Mail::Mailer
Mail::Mailer::qmail
Mail::Mailer::rfc822
Mail::Mailer::sendmail
Mail::Mailer::smtp
Mail::Mailer::testfile
Mail::Send

There are also a great number of mime modules installed, please ask me about anything specific that might be needed.

Last edited by gamorgan; 12-17-2010 at 06:29 AM.
 
Old 12-17-2010, 07:36 AM   #3
kontrabant
LQ Newbie
 
Registered: Oct 2010
Posts: 9

Rep: Reputation: 0
You could use:
1. for one file:

uuencode /path/to/mysql_dump.gz | mail -s "Mysql dump" user@somedomain.net


2. multiple files

mutt -s "Mysql dump" -a /path/to/mysql_dump.gz /path/to/mysql_dump1.gz -- user@somedomain.net < /dev/null

Last edited by kontrabant; 12-17-2010 at 07:37 AM.
 
Old 12-17-2010, 10:09 AM   #4
gamorgan
LQ Newbie
 
Registered: Dec 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for the reply, I will try them and send a reply shortly.

GM
 
Old 12-17-2010, 11:40 AM   #5
gamorgan
LQ Newbie
 
Registered: Dec 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Hi and thanks for your efforts

The first command did indeed send a message but no file can be attached.

mutt does not appear to be running, as the second command has no effect and I have tried many configurations of this, from the web.


Mmmmmmmmmmm anyone else have a solution?
 
Old 12-18-2010, 01:56 AM   #6
speck
Member
 
Registered: Nov 2001
Location: California
Distribution: Slackware 14.1
Posts: 272

Rep: Reputation: 54
Try the following

Code:
mailx -a attachment.gz -s "Subject Here" user@domain.com </dev/null
 
Old 12-19-2010, 02:49 AM   #7
gamorgan
LQ Newbie
 
Registered: Dec 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for your reply


No luck with this one, not the slightest hint of anything going on.

GM
 
Old 12-19-2010, 03:16 AM   #8
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Code:
uuenview -m email -f "my_email" -s "test subject" -a attachment.tar.gz << EOF
Greetings,
Alex
EOF
This will send a mail to email, putting the my_email address in the From: field and test subject in the Subject. The file specified with option -a will be attached to the mail. The here document serves the mail body. See man uuenview for more options. The uuenview command is provided by the uudeview package. Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line e-mail and NOT sending out malware nelson202tx Linux - Newbie 2 10-16-2010 02:36 AM
Sending mail from command line Geert86 Linux - Server 10 11-30-2009 12:04 PM
sending mail with bulk attachments onyangoliech Linux - Networking 1 12-04-2006 06:15 AM
Sending mail from command line matiasquestions Linux - Software 5 01-22-2006 11:51 AM
sending mail from command line won't work disorderly Linux - General 2 06-09-2005 11:29 AM


All times are GMT -5. The time now is 02:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration