Hello there. I have a little issue with my post-job script which is sending an email after backup. When I run it manually, everything works great - email is sent. But if the script path is set in job config, nothing happends, email is not sended. Here is a code:
Do you see any mention of the script in the session log in UI, any warnings? Also, please double-check if the path is correct. For better troubleshooting please add some sort of basic logging in your script please. For example, make it to write some info about the progress to some file after each operation so it would be possible to track at what stage the script fails.
There are no errors, no warnings and other info things for any debugging. The path is correct - I’ve chosen it using [Browse] button. Also I’be tried to make a simple debug scrip - simple echo actual date and time to end of specific file (echo $(date...) >> file.txt) and after doing backup, the file is empty.
PTide wrote:Would you mind adding another echo in the beginning, plus a couple of additional echoes inbetween start and end of the script?
Can you explain what for? This is simple situation - the post-job is launching a script file or not. If the script with one echo doesn't work, adding another echo will not provide of success.
In my opinion there might be more than one reason for the observed behaviour:
A) UI glitch + problem with the script: script actually was started but, for some reason, it didn't make it to the very end where 'echo' statement resides.
B) UI is fine, the script wasn't started at all.
If you are 100% sure "B" is the correct answer, then please open a case with our support team and post your case ID here.
Exactly the same for us, on all servers. Post job that should send mail after backup is finnished, stopped working after last update of the client. Works if you do it the "commanline" way, but not from the veeam agent client gui.
Any news on this?
./Johan
Hello, i have the same issue but it is not solved by adding an empry script with exit code 0 as a pre-job script. My veeam configuration is the following:
I found out the answer to my problem, the veeam job keeps a state of "Running" until the script finishes executing, so the mail was never sent. To fix this i made the mail sending part of the script a function and executed it in another process, this allowed the post script to finish and change its state while my function picks this up. Here is the code:
progress(){
#obtenemos el id y el status del ultimo BKP job
SESSION_ID=`veeamconfig session list | grep $JOBNAME | awk '{print $3}' | awk 'END{print}' | sed 's/[{}]//g'`
STATUS=`veeamconfig session info --id $SESSION_ID | grep State | awk '{print $2}'`
while [ $STATUS = 'Running' ]
do
#esperamos 30secs y volvemos a checkear el status del job hasta que deje de correr
sleep 30
STATUS=`veeamconfig session info --id $SESSION_ID | grep State | awk '{print $2}'`
done
#mandamos mail segun el status del BKP
if [ $STATUS = 'Warning' ]
then
WARN_MSG=`veeamconfig session log --id $SESSION_ID | grep warn | awk '{print $6,$7,$8,$9}'`
echo -e "Job $JOBNAME Successful with following $STATUS:\n\n$WARN_MSG\n\nJOB INFO:\n$JOB_INFO" | mailx -s "$VAL $STATUS" -r $EMAIL_FROM $EMAIL_TO
fi
if [ $STATUS = 'Failed' ]
then
echo -e "Job $JOBNAME $STATUS.\n\nJOB INFO:\n$JOB_INFO" | mailx -s "$VAL $STATUS" -r $EMAIL_FROM $EMAIL_TO
fi
if [ $STATUS = 'Success' ]
then
echo -e "Job $JOBNAME $STATUS.\n\nJOB INFO:\n$JOB_INFO" | mailx -s "$VAL $STATUS" -r $EMAIL_FROM $EMAIL_TO
fi
}
progress &
exit 0