Running Sendmail as a post-process command isn't working
I am running ATIH 2010 on a WIN 7 machine and utilizing chain2gen for handling my archives. I have no problems.
I created a new backup scheme in ATIH 2010 identical to the one I was using, except this time I added a post-processing command to call Sendmail to e-mail me when a full backup has been run. When I use the "Test Command" button within ATIH 2010, the command runs perfectly and I get an e-mail.
However, when the ATIH script runs in real-time, I do not get an e-mail when the full backup is created.
Any thoughts?
- Log in to post comments
Yes, I used the instructions provided in the C2G batch file.
the TI log file has the following:
"".
There is no error file for C2G, so I am assuming that all is OK from its viewpoint. As I said before, when I set up the backup task and used the "Test Command" button after entering the name of the file to run post-process, I got an e-mail saying the full backup had been run.
I don't know if this matters or not, but I am validating the backup. When exactly does the post-process command execute? I assume it executes after the validation process. If it runs prior to the validation process, is it possible that TI locks the .tib file somehow so that the post-process batch file doesn't "see" the file?
- Log in to post comments
OK. It appears that when I saved my last response the text I had copied from the TI log disappeared. Let's try this again. Here is the TI log entry:
event id="23" level="2" module="100" code="134" time="1375699396" message="Execution of user command succeeded: C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.bat"
- Log in to post comments
The error file is
Error_messages.txt
found in the same folder as the same path as used in the Pre command for
Acronis_PreProcessing_task.bat
When the post is run, Acronis has finished with the file.
The TI log file just tells us the file ran but not the results.
I don't know that it will change things but try changing the bat extension from bat to cmd via the rename process. You will need to edit the pre command to also make the change from .bat to .cmd
- Log in to post comments
The error file doesn't exist, so it must not be generating any errors. Since today was a full backup day, I ran the batch file directly (outside of TI) and it ran and generated an e-mail message that I received. I will try changing the extension from .bat to .cmd and see what happens in a week when the next full backup is generated by C2G.
- Log in to post comments
After added thought to the preceding post, here is other thoughts.
From within Windows Explorer, if you right click on the bat file
C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.bat"
Look at its security settings and see if it needs to be unlocked.
Another thought regrarding security.
Start notepad via
Start/All programs/accessories/
RIGHT click on the Notetab listing
Choose the "Run as Administrator" option
open the C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.bat" (or cmd)
Save as C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.cmd
This change gives it a higher security to run.
When editing the post command to correct the file name extension,
use the edit path and browse to the actual cmd file so that TI will add (or not add) its path information quotations.
- Log in to post comments
Sorry, but I just saw your post. I will try those things this evening after I get home. I am also going to experiment with creating a new task with the post-process command and run it with and without the validation process to see if that makes any difference.
- Log in to post comments
If your storage folder still only has the one file,
then you can test via double clicking on the
my_sendemail_on_full_backup.bat or the
my_sendemail_on_full_backup.cmd
which will send the email if it is working.
You can test without involving TI.
-------------------------
It must succeed in a test such as this before it can possibly succeed as a Post command.
- Log in to post comments
I double clicked on the .bat file last night and it ran just fine and sent me an e-mail (yesterday was full backup day). So I know that the batch file works properly. That is why I am thinking that it has something to do with the fact that I am validating my backup. I will let you know the results of my experiment.
- Log in to post comments
Keith,
There have been other reports of bat files not working in the post command but when saved as a cmd file, there was success. This is one reason why I am suggesting that you save the file as a cmd file and saved with the elevated command as indicated in my post #6. The run as administrator provides a hgiher security permission so able to run when others will prompt instead.
I will be interested in the results of your validation test but I will be very very surprised running or not running the validation has any bearing on the results. All TI is doing is initiating the start of a standalone cmd file and is not interacting with it in any way. It is the user file which must do all the work which is why I asked you to test by double-clicking on the cmd file.
- Log in to post comments
Grover:
Last night, I created the .cmd version of the file by running notepad as adminstrator, opening the .bat file and then saving it as a .cmd file. I then created a new non-scheduled backup task that uses the .cmd as a post-process command with no validation. It worked perfectly. I then deleted the newly created backup file, edited the task to include validation, ran the task and received no e-mail regarding the full backup.
This morning, after my normal backup task had run, I edited the .cmd file to add a pause after it sends the e-mail on full backup. I then started my test backup task with validation. It has now been 2 hours (the full backup process with validation normally takes about 1-1/2 hours to run) and I still don't have an e-mail. Once I get back home, I will check to see that there is a command window open waiting for me to hit any key to continue. If not then it would seem that the .cmd file isn't being called from the TI task when there is validation. We shall see.
- Log in to post comments
Here is a couple other things to try. Perhaps we have a timing issue in that the cmd file is checking too soon. Do leave the validation on for these checks.
If your target disk is a usb disk,
In Windows explorer, right click on the drive letter and click on PROPERTIES
Click on Hardware
Click on Properties
Click on Policies
Make sure the 'ENABLE CACHING" is UNCHECKED.
usb disks should not have enable caching checked because of quick removal.
Also, again open Notepad as an Administrator and edit the cmd file.
Add this command to line 2 (after echo off) of the cmd file.
TIMEOUT /T 1800 /NOBREAK
Save the file again as a cmd file
The 1800 seconds will insert a 30 miinute delay before the cmd file actually begins doing its thing.
- Log in to post comments
I will try these things this evening and let you know the results. Thanks for all of your help. It would have been nice if TI had the e-mail option on full backup only.
Grover, I checked the settings for the disk and it was set as you suggested. I also made the change to the .cmd file as you recommended. However, it has been 2 hours since the backup and validation have been completed, and no e-mail from sendmail. The TI log shows that is supposedly called the .cmd 30 minutes after the validation, but I think the log is showing the time the validation began, but not when it ended. I don't know if that would make a difference. However, since the post-process command functions properly when there is no validation. Then I can only conclude that the validation process is actually preventing the .cmd from executing, even though the TI log says it called the .cmd file.
Have you actually used the sendmail file in a backup and validate scheme and had success?
If I knew anything about programming, I would like to modify the .cmd file so that after it does its thing, it then runs a TI validation of the backup that just went (if that is even possible). In other words, have the .cmd run the validation and not the TI backup task as normal.
- Log in to post comments
Not sure what 2010 offers for notification, but the current version email notification offers the below but applicable to all backups.
enable/disable email notification if backup succeeds
enable/disable email notification if backup fails
enable/disable email notification if program is waiting for user action or response.
enable/disable include log file with email notification
- Log in to post comments
Since it appears to me that the validation process is somehow interfering with the post-process command to run the .cmd file which calls sendmail, I deleted the post-process command from the script. I then used Windows Task Scheduler to run the .cmd file, making sure that the timing of the scheduled task was sufficient enough to allow for the validation process to complete. It works perfectly, so the issue is resolved, just not in the way I would have liked.
- Log in to post comments
Thank you for the update. At least, you have it working.
Question: Did you try running the task via the Acronis Scheduler as suggested in post #12.
This is using validation and using the delay at the beginning of the cmd file.
- Log in to post comments
Grover:
I did try running the task via the Acronis Scheduler, and it did not work (see post #13). Thanks for your help.
- Log in to post comments
Thank you for clarifying. I was not understanding that your post #13 was a backup & validation test which had the TIMEOUT COMMAND included as line 3 of the C2G email cmd file.
There is one other option if you are interested in trying other options.
A different approach would be to create a new bat/cmd file and run the new file via Windows Task Scheduler on a schedule. The TrueImage scheulder would not be used.. It would be Windows Task Scheduler running the file "Backup-Notify.cmd "
The contents of the new cmd file (backup-notify.cmd) would be (
1. A shortcut to run TrueImage backup task with validation but without any post command.
2. C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.cmd
Contents of new Backup-Nofify.cmd
copy and paste into Notepad)
----------------
echo off
"C:\Program Files (x86)\Acronis\TrueImageHome\TrueImageLauncher.exe" /script:8C66F45A-13CF-4B4B-BF71-D703C9C356D9
C:\Applications\Chain2Gen\Backups\sendemail_on_full_backup.cmd
Exit
----------------
If you tested by changing your existing task file, then you could use the current path for C2G.
If you want to use two tasks (both old and new), then you would need to copy the contents of the Chain2Gen folder into a 2nd folder such as Chain2Gen-2 as the storage folder name would differ with each task.
I have about 10 folders of C2G--each running a different task as the parameters differ on each task.
If I remember correctly version 2010 has (2011-2013 has)a settings option inside the task which enables user to automatically create a task shortcut to your desktop. Then it is just a matter of copying the shortcut properties into the Backup-Notify.cmd as I have shown above.
- Log in to post comments
Grover:
I will try using the new .cmd file you suggest. That would certainly take the guess work out of when to run the sendmail .cmd file.
- Log in to post comments
Grover:
Before I test this, please confirm that the sendmail...cmd file will only run after the Acronis script has completed. If the file calls the Acronis script and then runs the sendmail .cmd file before the Acronis script has completed, then I think I will be back in the same boat of the sendmail .cmd not running.
- Log in to post comments
I don't know. I don't do programming. Yes, you may have the same issues.
Give me a few days. Maybe I can do some similar type testing and see what happens.
I will respond again after testing in a few days.
In the meantime, keep running what is working.
- Log in to post comments
Keith,
Using the suggestion I offered in post #19, I was NOT successful due to the timing issues so throw that suggestion out the window.
However, I do have another suggestion which worked in my testing.
We know that the TI program will not run two backup tasks simultaneously but will queue the 2nd task until after the first task finishes. So..
Use the Acronis scheduler to run your first task which is your normal task with Validation enabled but without any Post commands.
Create a 2nd task (TI scheduled a few minutes later) and use it to run your Post command email file notification.
This task can be just a simple files only backup of a single folder (perhaps your doc folder) and its only purpose is to provide a method of running the post command after the completion of the first task. Which data you backup is secondary but can be a configured as a useful backup.
The 2nd backup will provide ample time for the 1st task to write all its files to disk so the 2nd task post command will find the backup file created by the 1st task..
- Log in to post comments