Koozali.org: home of the SME Server

Additional Email address for do_backwk in V8

Offline compsos

  • *
  • 472
  • +0/-0
Additional Email address for do_backwk in V8
« on: November 06, 2011, 02:14:27 AM »
Hi

Trying to add another email address for the report to be sent to.

Has anyone tried adding an additional email address for the backup report from the do_backwk script?

Would the do_backwk file be the best point to modify or the crontab initialising the script?
Regards

Gordon............

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Additional Email address for do_backwk in V8
« Reply #1 on: November 06, 2011, 04:35:34 PM »
The backup from: and to: addresses appear to be hard-coded into /etc/e-smith/events/actions/workstation-backup-dar (from: admin-backup; to: admin).

To send these notifications elsewhere, modify the 'admin' account in server-manager and setup an email forwarding address.

I don't know if the 'forwarding address' field will take multiple email addresses - if it does, add as many as you want.  If it doesn't, create a group for admin notifications, add to that group all of the people you want to receive admin notifications, and modify the admin user to forward email to the new group.

If the above options don't meet your needs, I'd recommend:
- copy workstation-backup-dar to workstation-backup-dar.org
- modify /etc/e-smith/events/actions/workstation-backup-dar to use db variables for From & To
- create a 'new feature request' for this in the bug tracker, and upload the results of 'diff -u workstation-backup-dar workstation-backup-dar.org'

[warning: untested guess follows]
The modifications you'd need might look something like this:

Insert between lines 78 & 79:
78 my $mntdir = $backupwk->prop('Mount') || '/mnt/smb';
     my $frommail = $backupwk->prop('FromMail') || 'admin-backup';
     my $tomail = $backupwk->prop('ToMail') || 'admin';
79 my $tmpdir;

Then modify lines originally numbered 81 & 82 to look like this:
Old 81:
   $report .= "From: admin-backup\n";
Change to:
   $report .= "From: ".$frommail."\n";

Old 82:
   $report .= "To: admin\n";
Change to:
   $report .= "To: ".$tomail."\n";
 
Now set your workstation backup from: and to: addresses as follows:
config setprop backupwk FromMail backup@abccorp.org
config setprop backupwk ToMail support@abcconsulting.com


Offline compsos

  • *
  • 472
  • +0/-0
Re: Additional Email address for do_backwk in V8
« Reply #2 on: November 06, 2011, 10:41:30 PM »
Thanks mmccarn
The 2nd suggestion is along the lines we are looking for. Need just to send this report.
Will try and report back.
Regards

Gordon............

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Additional Email address for do_backwk in V8
« Reply #3 on: November 06, 2011, 11:44:33 PM »
compsos

Alternatively you can install the mailsorting contrib and create a rule for the admin user that sends a copy of the backup report to another email address.

This I believe is currently the most effective way to distribute any selected admin emails to other users.
« Last Edit: November 06, 2011, 11:49:20 PM by mary »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Additional Email address for do_backwk in V8
« Reply #4 on: November 07, 2011, 07:26:56 PM »
[warning: untested guess follows]
The modifications you'd need might look something like this:

Insert between lines 78 & 79:
78 my $mntdir = $backupwk->prop('Mount') || '/mnt/smb';
     my $frommail = $backupwk->prop('FromMail') || 'admin-backup';
     my $tomail = $backupwk->prop('ToMail') || 'admin';
79 my $tmpdir;

Then modify lines originally numbered 81 & 82 to look like this:
Old 81:
   $report .= "From: admin-backup\n";
Change to:
   $report .= "From: ".$frommail."\n";

Old 82:
   $report .= "To: admin\n";
Change to:
   $report .= "To: ".$tomail."\n";
That will only work temporarily. As soon as an update of e-smith0backup will be released and installed this will be overwritten. I think it is a bad suggestion, core code should not be modified. I suggest you launch a NFR to have this added, or better indeed use mailsorting in the admin e-mailbox to direct the message to another e-mailaddress.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Additional Email address for do_backwk in V8
« Reply #5 on: November 07, 2011, 07:43:10 PM »
That will only work temporarily. As soon as an update of e-smith0backup will be released and installed this will be overwritten. I think it is a bad suggestion, core code should not be modified. I suggest you launch a NFR to have this added, or better indeed use mailsorting in the admin e-mailbox to direct the message to another e-mailaddress.

there's a workaround:
- copy /etc/e-smith/events/actions/workstation-backup-dar to /etc/e-smith/events/actions/workstation-backup-mydar
- edit /etc/e-smith/events/actions/workstation-backup-mydar as for mmccarn suggestion
- change the backup program with
Code: [Select]
config setprop backupwk Program mydar

this will survive to system update but system migration/restore

I agree that a NFR is the best option

Offline compsos

  • *
  • 472
  • +0/-0
Re: Additional Email address for do_backwk in V8
« Reply #6 on: November 07, 2011, 10:51:11 PM »
Hi All
Thank you for the suggestions. mmccarn your mods are working perfectly. I will raise a NFR based on that code. Thank you.
Stefano, understand and good suggestion.


Regards

Gordon............