Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-22-2005, 03:38 PM   #1
LQ Newbie
Registered: Jun 2005
Location: Baltimore, MD
Distribution: Suse Enterprise Server 9.0
Posts: 7

Rep: Reputation: 0
Trouble working with file dates

Ok, I'm learning (OpenLDAP and Linux at the same time), but I'm stumped again. I can't find anything in the documentation, though it might be there somewhere. As stated previously, every day an LDIF file is created from the Active Directory domain controller, with only the desired fields exported to the ldif file. Another script copies the ldif file to the folder /data/openldaptemp and names the ldif file dump.ldif. That is where my script is supposed to pick up the ball and run with it. My script is supposed to stop the wipe the OpenLDAP database and import the dump.ldif file. I think I got it to do that properly.

However, now I am supposed to add the following functionality -

1) Rename the dump.ldif file to "dump-(today's date).ldif" before importing it
2) Delete any dump-mmddyyyy.ldif file older that a week
3) If slapadd reports an error, redo the import with the previous ldif file
4) If slapadd reports an error, alert the administrator in some manner

I've posted this question to OpenLDAP's forum for help with 3), but I also need help on the other 3 questions. Any ideas?

# This script shuts down the LDAP database, deletes the files, # starts the database to initialize it, shuts it down again (to # prevent damage to the database during the slapadd import), imports # the LDIF file to recreate the database, and then finally # starts the database again.

/etc/init.d/ldap stop
rm /data/duckpond.dol/*
/etc/init.d/ldap start
/etc/init.d/ldap stop
/usr/sbin/slapadd -l /data/openldaptemp/dump.ldif /etc/init.d/ldap start
Old 06-22-2005, 04:22 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Assuming that you're in the dif-directory...

mv dump.ldif dump-`date +%Y%m%d`.ldif
find -name "dump*" -ctime +7 -exec rm {} \;

if [[ <slapderror]]; then mail -s OOOPS admin@my.domain; fi

Old 07-21-2005, 12:11 PM   #3
LQ Newbie
Registered: Jun 2005
Location: Baltimore, MD
Distribution: Suse Enterprise Server 9.0
Posts: 7

Original Poster
Rep: Reputation: 0
Thumbs up That took care of part of the problem

I'll create a new post for the rest. Thanx!

Last edited by cboxall; 07-21-2005 at 01:40 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
file created/accessed dates plainkeyman Linux - General 4 10-27-2005 08:34 PM
file dates digitalgravy Linux - General 2 01-20-2005 11:58 AM
File Dates Rv5 Programming 5 09-07-2004 06:59 PM
Sorting a file containing dates subu_s Linux - General 2 06-03-2004 02:07 PM
File dates. vexer Programming 5 04-28-2004 01:14 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration