mikep Posted December 30, 2008 Share Posted December 30, 2008 Hi Everyone, I am a long time reader but this is my 1st post! I made a small package to add email support using the bashmail script from unraid_notify package. Credits goes to brainbone for unraid_notify package. It use the same config file as unraid_notify (/boot/config/unraid_notify.cfg). I made this to enable sending email from any scripts and/or crontab jobs without using unraid_notify. You still have to install unraid_notify-2.20-noarch-unRAID.tgz package *BUT* you don't have to start it if you don't want to. Syntax: mail [--subject 'subject'] [--rcpt '[email protected]']" Samples Usage: cat filename.txt | mail echo 'this is a test' | mail echo 'this is a test' | mail --subject 'ATTENTION' echo 'this is a test' | mail --subject 'ATTENTION' --rcpt [email protected] You can override the subject and the rcpt from the configuration file (unraid_notigy.cfg) with the optionals parameters. Regards Mike Quote Link to comment
bubbaQ Posted January 20, 2009 Share Posted January 20, 2009 @mikep I was just getting ready to write something like this to use bashmail, and you have already done it. Thank you. I did make one change, so that the recipient comes from "ErrorRcptTo" and not "RcptTo" since a lot of people leave the latter blank, as they only want e-mail in the event of errors. Quote Link to comment
brainbone Posted January 22, 2009 Share Posted January 22, 2009 Nice work! Just a note: I updated unraid_notify to version 2.30, fixing some bugs dealing with the "To:" field in the message header and multiple recipients. bashmail was also updated, using EHLO instead of HELO, allowing authentication with earthlink smtp servers. Quote Link to comment
cflammia Posted January 25, 2009 Share Posted January 25, 2009 I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package? I guess with this, you can send emails from any script that has an output? What would be some practical applications of this? Thanks Chris Quote Link to comment
Joe L. Posted January 25, 2009 Share Posted January 25, 2009 I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package? I guess with this, you can send emails from any script that has an output? What would be some practical applications of this? Thanks Chris Some of the add-on scripts can be configured to use mail to communicate their status. the APC UPS daemon is one. (I used my own script that in turn uses netcat for the actual connection to the mail server, but this is equally capable.) Quote Link to comment
mikep Posted January 27, 2009 Author Share Posted January 27, 2009 I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package? I guess with this, you can send emails from any script that has an output? What would be some practical applications of this? Thanks Chris I wrote that script to use with APC UPS daemon and also some custom cron jobs... Regards Mike Quote Link to comment
cflammia Posted January 27, 2009 Share Posted January 27, 2009 OK. I tried to play with this a bit to see what I could do. For example, I wrote a little script to save a text file containing the SMART info from drive #1 then email this to me. Here's the script: smartctl -a -d ata /dev/sdc | todos >/boot/smart.txt cat /boot/smart.txt | mail --subject 'SMART info Disk1' --rcpt [email protected] When I look at the email I get, the formatting is messed up. It looks like it doesn't print the tabs, so all the columns in the report do not line up and it's hard to read. If I check the text file, it's OK. Is there a way to keep the formatting intact? I tried using todos and not using it but it made no difference. I also tried using "show in fixed width font" in Gmail but that didn't help either. Any suggestions? Thanks Chris Quote Link to comment
JarDo Posted January 31, 2009 Share Posted January 31, 2009 Might there be a way to add an SMS feature. I can send an email to my phone with this script via SMS (i.e. [email protected]), and this works just fine. The problem I'm trying to avoid is that the default message creates 2 SMS texts because there are so many lines included in the message (FRM, SUBJ, MSG, Server Name, Date, and the message.) If there were an SMS option (switch) so that only the message (or subject) were actually sent, that would be great. I'd use this feature to notify me of specific 'events' (such as rsync completed sucessfully). Quote Link to comment
jbuszkie Posted March 4, 2009 Share Posted March 4, 2009 Here is the modified script to put in a couple of changes that brianbone added to make earthlink on the unraid_notify work. you can use it if you want.. but it's mainly for me when I forget about where I put my modified copy! :-) (remove the .txt in the file name) Quote Link to comment
jbuszkie Posted May 28, 2009 Share Posted May 28, 2009 Here is an updated version that more conforms to the berkley standard for mail. It will either take the old parameters or the standard ones. So Samples Usage: cat filename.txt | mail echo 'this is a test' | mail echo 'this is a test' | mail --subject 'ATTENTION' echo 'this is a test' | mail --subject 'ATTENTION' --rcpt [email protected] All still work or... cat filename.txt | mail echo 'this is a test' | mail echo 'this is a test' | mail -s 'ATTENTION' echo 'this is a test' | mail -s 'ATTENTION' [email protected] Will also work. This still requires unraid_notify to be installed The program is attached.. just remove the .txt Or the whole package is there too... Quote Link to comment
brainbone Posted May 29, 2009 Share Posted May 29, 2009 What are everyone's thoughts on rolling this in to unraid notify? Quote Link to comment
prostuff1 Posted May 29, 2009 Share Posted May 29, 2009 Works for me, the more options and more we can comply to the standards the better! I think making unRAID notify and this e-mail script one is a good thing in the long run so as not to confuse new people. Quote Link to comment
RobJ Posted May 29, 2009 Share Posted May 29, 2009 Works for me, the more options and more we can comply to the standards the better! I think making unRAID notify and this e-mail script one is a good thing in the long run so as not to confuse new people. I strongly agree. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.