Bacula-users

Re: [Bacula-users] Query what clients haven't been backed up within a certain time period

2012-06-23 09:21:38
Subject: Re: [Bacula-users] Query what clients haven't been backed up within a certain time period
From: Geert Stappers <Geert.Stappers AT vanadgroup DOT com>
To: "bacula-users AT lists.sourceforge DOT net" <bacula-users AT lists.sourceforge DOT net>
Date: Sat, 23 Jun 2012 15:20:00 +0200
Op 20120622 om 16:52 schreef Dan Langille:
> On 2012-06-21 19:54, Mike Hobbs wrote:
> > Hello, I was wondering if anyone has written a bacula query that you 
> > can
> > run to find out what clients haven't been backed up within a certain
> > time period?  If so could you share?  I'm not an SQL guy which is why 
> > I
> > am asking.
> 
> This query provides a list of all clients who have not had a backup 
> finish within the past week:
> 
> SELECT C.name
> FROM client C
> WHERE NOT EXISTS (SELECT jobid
>         FROM job J
>          WHERE J.endtime > (now() - interval '1 week')
>            AND J.clientid = C.clientid)
> ORDER BY name
> 
> This was written for PostgreSQL. 
> I hope it runs on MySQL with minor modifications.
> 

Yes, after minor modifications it does run on MySQL

SELECT C.name FROM Client C WHERE NOT EXISTS
 ( SELECT jobid
   FROM Job J
   WHERE J.endtime > date_sub( now(),INTERVAL 1 week )
   AND J.clientid = C.clientid
 )
ORDER BY name


Cheers
Geert Stappers
-- 
http://www.vanadplatform.com/
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>