Modified Notify system


Recommended Posts

I recently had a need/want to have the system send an email to my wife's email address when her SD cards were finished backing up to the server. I use Unassigned Devices to fire off a script when she inserts the card into the server that backs up the card to a server share. But she wouldn't know when it was done unless I had her email address in the notification settings.

 

She doesn't care to receive the usual system notifications such as parity checks, temp warnings, etc. And I don't care to receive the notifications when her card is done backing up. But unless I interacted with ssmtp directly, I didn't have much choice.

 

So I modified the Notify script to allow a little more flexibility, posting here in case it helps anyone else. Really simple change that doesn't affect current functionality, maybe the update can be included in the next release of unraid?

 

List of changes:

Line 22: Updated example usage

Line 30: Explanation of option

Line 50: Added recipients to function parameters

Lines 54-57: If -r flag was used and an email address was provided, use that. If not, use the default email list from the notification settings

Line 167: Add 'r' option

Lines 186-188: Add case for 'r' option

Line 203: pass in list of recipients to generate_email function

 

So if my notification settings are set to send the emails to [email protected], in the backup script when I fire off a notification I pass in '-r "[email protected]"' which now overrides the default email in the notification settings and only sends it to her.

 

Currently of course, you would need to add a line in your go file or if you are using the user scripts plugin you could add it there as well and set it to run at array start. The notify script resides at '/usr/local/emhttp/webGui/scripts/notify'

 

If you had the new notify script saved to /boot/scripts/ you would add this to the go file (or user script)
 

cp /boot/scripts/notify /usr/local/emhttp/webGui/scripts/notify

 

notify

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.