[389-users] How to tell when database backup has finished?

Rich Megginson rmeggins at redhat.com
Tue Apr 10 14:24:53 UTC 2012


On 04/10/2012 07:25 AM, MATON Brett wrote:
>
> Thanks for the suggestions.
>
>   For the record, status 32 was an error on my part, I hadn’t quoted 
> the bind DN so ldapsearch was actually complaining about the bind DN 
> not being found, not the backup task.
>
>   Noriko, I’ve searched “cn=backup,cn=tasks,cn=config” and can’t find 
> nstaskstatus anywhere.  I’m assuming that it also gets deleted once 
> the task is complete...
>
>
> cn=backup,cn=tasks,cn=config is the parent entry for all backup task 
> entries.  When you create an entry under this parent, it starts the 
> backup task.   It is the backup task entry that has the nsTaskStatus 
> attribute, not the parent entry "cn=backup,cn=tasks,cn=config".  When 
> the backup task is complete, and the ttl is expired, the backup task 
> entry is automatically removed.
>
> Hi Rich,  I appreciate your clarification.  I did however mean that I 
> was searching “cn=backup,cn=tasks,cn=config” with no additional 
> filters which should have returned everything, nsTaskStatus included 
> for any backup job?
>
Exactly what search parameters (e.g. ldapsearch command line arguments) 
did you use?
>
>   I might just be having a dumb moment but I couldn’t think of an 
> efficient way to check the error log for a Backup Finished entry, 
> anyone with suggestions?
>
>
> The best way is to do the ldapsearch as described above.
>
>   I’m still having issues, $taskDN for example would be something like 
> cn=backup_2012_4_5_13_36_23, cn=backup, cn=tasks, cn=config
>
>
> COUNT=1
>
> while [ ${COUNT} -ne 0 ]; do
>
> #
>
> #  OOPS:  -b ${taskDN}
>
> #         -b "cn=backup,cn=tasks,cn=config" "cn=<task>"
>
> #
>
>         COUNT=$(ldapsearch -x -H ${HOST} -D "${BINDAS}" -y ${PWFILE} 
> -b "cn=backup,cn=tasks,cn=config" "(${taskDN})" dn | grep -c '^dn')
>
so this would expand to something like
COUNT=$(ldapsearch -x -H ldap.example.com -D "cn=directory manager" -y 
pwfile.txt -b "cn=backup,cn=tasks,cn=config" 
"(cn=backup_2012_4_5_13_36_23, cn=backup, cn=tasks, cn=config)" dn | 
grep -c '^dn')

This is incorrect in the following ways:
1) the argument to -H must be a valid LDAP URL - so -H 
ldap://ldap.example.com
2) "(cn=backup_2012_4_5_13_36_23, cn=backup, cn=tasks, cn=config)" is 
not a valid LDAP search filter - if you want to search for the backup 
entry, do one of the following
a) ldapsearch ... -s base -b "cn=backup_2012_4_5_13_36_23, cn=backup, 
cn=tasks, cn=config" ...
or
b) ldapsearch ... -b "cn=backup, cn=tasks, cn=config" 
"(cn=backup_2012_4_5_13_36_23)" ...

>         if [ ${COUNT} -ne 0 ]; then
>
>                 sleep 5s
>
>         fi
>
> done
>
> $(tar czf ${BACKUPPATH}${BKTSTAMP}-${INSTANCE}.tgz -C / ${DSBACKUPDIR#/*})
>
> However the tar file is incomplete, because (assumption) the backup 
> has not finished writing to disk before tar starts....
>
>   For the time being I’ve settled on two scripts, one to start backups 
> and another to archive yesterdays (or older) backups.  Not ideal but 
> workable
>
> Thanks again,
>
> Brett
>
> *From:*389-users-bounces at lists.fedoraproject.org 
> <mailto:389-users-bounces at lists.fedoraproject.org> 
> [mailto:389-users-bounces at lists.fedoraproject.org] *On Behalf Of 
> *Noriko Hosoi
> *Sent:* 05 April 2012 18:40
> *To:* General discussion list for the 389 Directory server project.
> *Subject:* Re: [389-users] How to tell when database backup has finished?
>
> You could search the task.with nstaskstatus attribute.
>
> $ ldapsearch -LLLx -h localhost -p <port> -D 'cn=directory manager' -w 
> <pw> -b "cn=backup,cn=tasks,cn=config" "(cn=backup_*)" nstaskstatus
>
> When the task is done, you'll see the "Backup finished." status:
> dn: cn=backup_2012_4_5_9_35_35,cn=backup,cn=tasks,cn=config
> nstaskstatus: Backup finished.
>
> Another way would be checking the errors log, which logs the end of 
> the back up.
>
>
> [05/Apr/2012:09:32:09 -0700] - Backing up file 31 
> (/var/lib/dirsrv/slapd-totoro/bak/totoro-2012_4_5_9_32_8/DBVERSION)
> [05/Apr/2012:09:32:09 -0700] - Backup finished.
>
> Thanks,
> --noriko
> MATON Brett wrote:
>
> Hi guys,
>
> I want to tar up the backup set once a db2bak.pl backup job has finished.
>
> however because it writes an entry to the LDAP and doesn’t wait for 
> the backup to finish I was wondering what the best way to determine 
> when the backup has actually finished?
>
> I was thinking that I could
>
> Ldapsearch at intervals for the backup cn entry, when it’s not there 
> anymore backup has finished
>
> Ro maybe watch the audit log for a delete action on the backup cn entry..
>
> Any thoughts appreciated.
>
> Cheers,
>
> Brett
>
> -------------------------------------------------------------------
>
> *GreeNRB**
> */NRB considers its environmental responsibility and goes for green IT./
> /May we ask you to consider yours before printing this e-mail? /**
>
> *NRB, daring to commit
> */This e-mail and any attachments, which may contain information that 
> is confidential and/or protected by intellectual property rights, are 
> intended for the exclusive use of the above-mentioned addressee(s). 
> Any use (including reproduction, disclosure and whole or partial 
> distribution in any form whatsoever) of their content is prohibited 
> without prior authorization of NRB. If you have received this message 
> by error, please contact the sender promptly by resending this e-mail 
> back to him (her), or by calling the above number. Thank you for 
> subsequently deleting this e-mail and any files attached thereto./
>
>
>
>
>
> --
> 389 users mailing list
> 389-users at lists.fedoraproject.org  <mailto:389-users at lists.fedoraproject.org>
> https://admin.fedoraproject.org/mailman/listinfo/389-users
>
> -------------------------------------------------------------------
>
> *GreeNRB**
> */NRB considers its environmental responsibility and goes for green IT./
> /May we ask you to consider yours before printing this e-mail? /**
>
> *NRB, daring to commit
> */This e-mail and any attachments, which may contain information that 
> is confidential and/or protected by intellectual property rights, are 
> intended for the exclusive use of the above-mentioned addressee(s). 
> Any use (including reproduction, disclosure and whole or partial 
> distribution in any form whatsoever) of their content is prohibited 
> without prior authorization of NRB. If you have received this message 
> by error, please contact the sender promptly by resending this e-mail 
> back to him (her), or by calling the above number. Thank you for 
> subsequently deleting this e-mail and any files attached thereto./
>
>
>
>
> --
> 389 users mailing list
> 389-users at lists.fedoraproject.org  <mailto:389-users at lists.fedoraproject.org>
> https://admin.fedoraproject.org/mailman/listinfo/389-users
>
> -------------------------------------------------------------------
>
> *GreeNRB
> */NRB considers its environmental responsibility and goes for green IT./
> /May we ask you to consider yours before printing this e-mail? /**
>
> *NRB, daring to commit
> */This e-mail and any attachments, which may contain information that 
> is confidential and/or protected by intellectual property rights, are 
> intended for the exclusive use of the above-mentioned addressee(s). 
> Any use (including reproduction, disclosure and whole or partial 
> distribution in any form whatsoever) of their content is prohibited 
> without prior authorization of NRB. If you have received this message 
> by error, please contact the sender promptly by resending this e-mail 
> back to him (her), or by calling the above number. Thank you for 
> subsequently deleting this e-mail and any files attached thereto./
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/389-users/attachments/20120410/5db18b18/attachment.html>


More information about the 389-users mailing list