jlficken Posted December 15, 2019 Share Posted December 15, 2019 Is there any way to send attachments with the notify script? I'd like to send the rsync log with the e-mail if possible. Quote Link to comment
bonienl Posted December 15, 2019 Share Posted December 15, 2019 Attachments are not possible, but you can include messages (-m option). notify [-e "event"] [-s "subject"] [-d "description"] [-i "normal|warning|alert"] [-m "message"] [-x] [-t] [add] create a notification use -e to specify the event use -s to specify a subject use -d to specify a short description use -i to specify the severity use -m to specify a message (long description) use -x to create a single notification ticket use -r to specify recipients and not use default use -t to force send email only (for testing) all options are optional notify init Initialize the notification subsystem. notify smtp-init Initialize sendmail configuration (ssmtp in our case). notify get Output a json-encoded list of all the unread notifications. notify archive file Move file from 'unread' state to 'archive' state. Quote Link to comment
Muzzy Posted January 16, 2022 Share Posted January 16, 2022 (edited) Hi, how exactly i can use -m parameter to add the content of the script log file to mail? Thanks Edited January 16, 2022 by Muzzy Quote Link to comment
Squid Posted January 16, 2022 Share Posted January 16, 2022 -m "This is the message" A log file however may be pretty long to do this, and would no doubt include CRs, quotes etc that you would have to properly escape. Quote Link to comment
Muzzy Posted January 16, 2022 Share Posted January 16, 2022 So I understand correctly that there is no way to send either the log file or its contents via the internal notification system? Quote Link to comment
trurl Posted January 16, 2022 Share Posted January 16, 2022 Why can't you access the logs from your server after you get the notification? Quote Link to comment
Muzzy Posted January 16, 2022 Share Posted January 16, 2022 Of course I can, but reading the log in an email anywhere in the world is easier than connecting to vpn via some secure device, logging in to the server, finding the log and checking. I'm just asking, it would just be easier. Quote Link to comment
Squid Posted January 16, 2022 Share Posted January 16, 2022 The notify script was never designed for what you want to do. Investigate using the sendmail command or your own custom script using php's mail command etc... Quote Link to comment
emvau Posted February 22, 2022 Share Posted February 22, 2022 On 1/16/2022 at 3:53 PM, Muzzy said: Hi, how exactly i can use -m parameter to add the content of the script log file to mail? Thanks This works for me: /usr/local/emhttp/plugins/dynamix/scripts/notify -e "test" -s "test2" -d "test3" -i "normal" -m "$(cat /path/to/logfile.log)" 1 1 Quote Link to comment
bonienl Posted February 22, 2022 Share Posted February 22, 2022 The message with the -m option is only available in email notifications. The message can be indeed the content of a log file. Quote Link to comment
Muzzy Posted March 6, 2022 Share Posted March 6, 2022 On 2/22/2022 at 7:34 PM, emvau said: /usr/local/emhttp/plugins/dynamix/scripts/notify -e "test" -s "test2" -d "test3" -i "normal" -m "$(cat /path/to/logfile.log)" Awesome, it works 🙂 Thanks 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.