grufocom / vee-mail

Simple Script to get Mails from Free Veeam Agent for Linux
GNU Affero General Public License v3.0
49 stars 14 forks source link

vee-mail launched from another script #32

Closed luca7734 closed 2 years ago

luca7734 commented 2 years ago

I would like to run vee-mail from a veeam post-job script with command 'sh /opt/vee-mail/vee-mail.sh' at 1st line (sh is symlinked to bash shell) but seems that job infos are not catched correctly:

vee-mail: DURATION: , START: Friday, 13 May 2022 09:09:06, END: Thursday, 01.01.1970 01:00:00, STIME: 09:09:06, ETIME: 01:00:00 I always get 1/1/1970 end date and e-mail is not sent.

If i run vee-mail directly as a post-job script it runs fine.

thanks a lot

grufocom commented 2 years ago

Hi, the problem is that when your post-job script starts the vee-mail script it does not sleep for 30 seconds because it was not startet by veeamjobman directly. the veeam job is finished but has not written it's end time/date into the sql-database. If you start from a post-job script please include a sleep command before executing the vee-mail script: sleep 30 && sh /opt/vee-mail/vee-mail.sh Regards Manfred

luca7734 commented 2 years ago

tried sleep 60 but same result 10:21:47 Executing post-job script 10:22:48 Post-job script has been executed successfully DURATION: , START: Friday, 13 May 2022 10:21:35, END: Thursday, 01.01.1970 01:00:00, STIME: 10:21:35, ETIME: 01:00:00

I have to investigate further.... thank you

grufocom commented 2 years ago

I think you have to start the command as a background job, veeam waits until the post job is finished!

try this: sleep 30 && sh /opt/vee-mail/vee-mail.sh &

luca7734 commented 2 years ago

now it works perfectly! thank you so much

grufocom commented 2 years ago

you are welcome! :-)