December 30, 200817 yr 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
January 20, 200917 yr @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.
January 22, 200917 yr 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.
January 25, 200917 yr 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
January 25, 200917 yr 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.)
January 27, 200917 yr Author 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
January 27, 200917 yr 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
January 31, 200917 yr 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).
March 4, 200917 yr 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)
May 28, 200917 yr 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...
May 29, 200917 yr 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.
May 29, 200917 yr 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.
Archived
This topic is now archived and is closed to further replies.