Re: [BackupPC-users] DumpPreUserCmd to send an email before and after backup

2009-02-03 Thread Les Stott
Nick Smith wrote:
 Wow, that looks pretty impressive! I would like to try something like
 that out at my site.
 I had a couple questions.

 Where are the variables defined? aka $user $host $3 etc?
 Are they internal backuppc variables already defined or do i need to
 do that somewhere?

 thanks for the help, and thanks for posting this.

   
They are internal variables already defined by backuppc.

When you are editing the config via the backuppc web interface click on 
the underlined name for DumpPreUserCmd and it will take you to a help 
page which will tell you what variables can be used and what are available.

Regards,

Les


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/


Re: [BackupPC-users] DumpPreUserCmd to send an email before and after backup

2009-01-29 Thread Nils Breunese (Lemonbit)
Regis wrote:

 I would like backuppc send an email to $host and or $user, to notify  
 when a full backup being to start

 I know it's by DumpPreUserCmd, but anyone can help me to write it?

You can use the mail command. Something like this:

/bin/echo This is the message | /bin/mail -s This is the subject  
to_address

Nils Breunese.

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/


Re: [BackupPC-users] DumpPreUserCmd to send an email before and after backup

2009-01-29 Thread Les Stott
Madcha wrote:
 Thanks,

 But how write this command, for send an email to $host? or $user?

   
Here is one way to do it, maybe not the most elegant but it works. Use 
it as a guide and improve on it. I set this up ages ago for a client, 
never tweaked it since then.

These will send a note before to say its starting, and then send a note 
after if it completes, whether successful or not. It will also log to 
the hosts backuppc log file. If there is an error it will log that also.

You need to create 4 files. the sample scripts below assume you put them 
in /usr/local/bin

startbkpemail.txt  - body text for email before
startbkpemail.sh   - script to send the email before
endbkpemail.txt   - body text for email after
endbkpemail.sh - script to send email after

Modify the variables at the top of the scripts to suit your setup.

Call them in BackupPC like so
$Conf{DumpPreUserCmd}= '/usr/local/bin/startbkpemail.sh $user 
$xferOK $host $type $cmdType';
$Conf{DumpPostUserCmd}= '/usr/local/bin/endbkpemail.sh $user $xferOK 
$host $type $cmdType';

they should contain something like:

startbkpemail.txt
-
THIS IS AN AUTOMATED SYSTEM MESSAGE!!
PLEASE DO NOT REPLY!!

Your Computer is being backed up by the
Automated System Backup Server.

During this time you may experience some slowness on
the network. This is usually only for a short period.

You will receive a confirmation E-mail when the
Backup Completes.
-

startbkpemail.sh
-
#!/bin/sh
#
#$Conf{DumpPreUserCmd}= '/usr/local/bin/startbkpemail.sh $user 
$xferOK $host $type $cmdType';
#$Conf{DumpPostUserCmd}= '/usr/local/bin/endbkpemail.sh $user 
$xferOK $host $type $cmdType';

varDate=`date '+%F %T'`
DOMAIN=yourdomain.com.au
BACKUPPCPATH=/path/to/data/directory
BACKUPPCLOG=$BACKUPPCPATH/log/LOG
notify=$...@${domain}

/bin/mail -sA Backup of $3 has started... ${NOTIFY}  
/usr/local/bin/startbkpemail.txt
/bin/echo $varDate Backup Started E-mail sent to:(' $1' ) $BACKUPPCLOG
-

endbkpemail.txt
-
THIS IS AN AUTOMATED SYSTEM MESSAGE!!
PLEASE DO NOT REPLY!!

Your Computer has been backed up by the
Automated System Backup Server.
-

endbkpemail.sh
-
#!/bin/sh
#
#$Conf{DumpPreUserCmd}= '/usr/local/bin/startbkpemail.sh $user 
$xferOK $host $type $cmdType';
#$Conf{DumpPostUserCmd}= '/usr/local/bin/endbkpemail.sh $user 
$xferOK $host $type $cmdType';

varDate=`date '+%F %T'`
DOMAIN=yourdomain.com.au
BACKUPPCPATH=/path/to/data/directory
BACKUPPCLOG=$BACKUPPCPATH/log/LOG
notify=$...@${domain}

### If $2 is a 1, backup completed.

if [ $2 = 1 ]
then
   /bin/mail -sBackup of $3 has Completed Successfully. ${NOTIFY}  
/usr/local/bin/endbkpemail.txt
   /bin/echo $varDate Backup Completed E-mail sent to:(' $1' ) 
 $BACKUPPCLOG
else
   /bin/mail -sBackup of $3 has Failed. Contact your System Admin. 
${NOTIFY}  /usr/local/bin/endbkpemail.txt
   /bin/echo $varDate 'Exit code:(' $2 ') Asset Tag:(' $3')  E-Mail:(' 
$1' )' $BACKUPPCLOG
fi
-

That should give you a good starting point.

Regards,

Les

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/