Hi Brett,
I think running the ldapsearch, and checking for error 32 is the easiest
option.
I know you're not hitting this, but there are times when the task will
stick around for a minute after its completed. In that case, you can
search for the task, and request the attribute "nsTaskStatus". Then
grep the value for "Backup finished", or "Backup failed".
Regards,
Mark
On 04/05/2012 08:22 AM, MATON Brett wrote:
Oops, the ldapsearch –b is wrong I think the search should be
ldapsearch -x -H ${HOST} -D ${BINDAS} -b '
cn=backup,cn=tasks,cn=config' -y ${PWFILE} 'cn=<tasked>'
In short, if I immediately start the tar task after running db2bak.pl
in my script, the target backup directory doesn’t exist.
So I need to check if the backup task has finished.
The DB is so small here though that that task has finished ( and the
task deleted ) before I can run an ldapsearch to check the base and
filter (even if I put it in the script before ‘tar’).
*From:*389-users-boun...@lists.fedoraproject.org
[mailto:389-users-boun...@lists.fedoraproject.org] *On Behalf Of
*MATON Brett
*Sent:* 05 April 2012 14:10
*To:* General discussion list for the 389 Directory server project.
*Subject:* Re: [389-users] How to tell when database backup has finished?
Bit of a fiddle:
Execute the d2bak.pl script in verbose mode and extract the task name:
task=$(${BACKUPCMD} -v -D "${BINDAS}" ${BACKUPOPTS} -a ${DSBACKUPDIR}
2> /dev/null | grep "^adding new entry" )
ERR=$?
task=${task#*\"}
taskDN=${task%?}
Syslog message and exit if script failed:
if [ $ERR -ne 0 ]; then
LogIt "FAILED (${ERR})." "user.err";
exit 1;
fi
Until “task” isn’t found ( 32 ) hang around here....:
while [ ${ERR} != 32 ]; do
(ldapsearch -x -H ${HOST} -D ${BINDAS} -b '${taskDN}' -y
${PWFILE} > /dev/null 2>&1 )
ERR=$?
if [ ${ERR} != 32 ]; then
sleep 5s
fi
done
Again any thoughts welcomed.
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./
-------------------------------------------------------------------
*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-us...@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-users
--
389 users mailing list
389-us...@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-users