-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Dec 09, 2010 1:25 pm
- Full Name: Corey
- Contact:
Email on long running job
Every couple of months, typically over a weekend, my Veeam jobs will get stuck at 0%. I have no idea why this happens and Veeam Support has pointed me to this article: http://www.veeam.com/kb1727. The problem is when this happens - on a weekend. I don't find out until Monday (or with Today's case, Tuesday because of the holiday). We're still trying to determine why it's happening.
What I'd like to know is how I could script something simple that will check all the current running jobs to see if they have been running longer than 8 hours. I'll schedule the script to run every hour. If there is a job running longer than 8 hours, I want it to email me with the job name.
Is this possible? Thanks.
What I'd like to know is how I could script something simple that will check all the current running jobs to see if they have been running longer than 8 hours. I'll schedule the script to run every hour. If there is a job running longer than 8 hours, I want it to email me with the job name.
Is this possible? Thanks.
-
- Product Manager
- Posts: 20406
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Email on long running job
Hi Corey, do you have Veeam ONE deployed? If so, you can use one of its alarms that will notify you, if job exceeds allocated time interval. Thanks.
-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Dec 09, 2010 1:25 pm
- Full Name: Corey
- Contact:
Re: Email on long running job
I do not. I assume that's only available in the full version of Veeam ONE?v.Eremin wrote:Hi Corey, do you have Veeam ONE deployed? If so, you can use one of its alarms that will notify you, if job exceeds allocated time interval. Thanks.
-
- Product Manager
- Posts: 20406
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Email on long running job
Yes, job duration alarm is shipped in paid version of Veeam ONE. As to PS, you should write something like this:
Thanks.
Code: Select all
$Date = Get-Date
$Jobs = Get-VBRJob | where {$_.Getlaststate() -eq "Working"}
Foreach ($Job in $Jobs){
if (($Date - ($Job.FindLastSession().CreationTime)).hours -ge 8){
$Job | Stop-VBRJob
}
}
-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Dec 09, 2010 1:25 pm
- Full Name: Corey
- Contact:
Re: Email on long running job
I couldn't figure out how to query for running jobs. It's "working". Thanks!
-
- Product Manager
- Posts: 20406
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Email on long running job
And if you want just to have notification, not immediately stop a long running job, then, replace "stopping" part with something that has to with email creation. Thanks.
Who is online
Users browsing this forum: No registered users and 13 guests