Shell Scripted Document Management System


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Scripted Document Management System
# 1  
Old 02-09-2009
Shell Scripted Document Management System

Over the past 4 -5 years, I have cobbled together a rudimentary 'Document Management System' for a school district I support using Linux Bash Shell scripts..

The purpose of the scripting was to supplement features of a Job Applicant Center that had very simplistic methods of handle file attachments.

They are in process of upgrading to a new revision of the software and the new version uses a database table on the backup to index documents available for viewing on the Web Management viewer.

The "district" has a scanning process that runs outside the package.. (as the software package is a Job Applicant Center) scanning was not taken into consideration..

What we have defined is a "STAGED LOCATION"

Each file in this staging area will have a consistent named value, but there is no way at scanning time to check the database content.
TABLE FIELDS
FIELD1:<DOCID>
FIELD2:<ITERID>
FIELD3:<DOCID>
FIELD4:<{DESCRIPTIVE}&{STORENAME}>
FIELD5: <STORENAME>

The 1st Field is created when an Applicant applies for a Job and attaches a resume to the application.

The 2nd field is a system constant of "O" (zero)

The 5th Field is a concatenation
<APPID>_<ITERID>_<DOCID>.ext

The 4th Field <{DESCRIPTIVE}&{STORENAME}>
is a concatenation of the other strings plus a descriptive of the contents of the file placed there by the person doing the scanning.

The "DOCID" (Field 3) is my problem:


For example:
1. LOR1_1234_0_1.ext
For Letter of Reference
2. TRANSCRIPT_1234_0_1.ext
For College Transcripts

I've been able to reach a point where I need to check the values of staged files against the values in the database. the VALUE OF DOCID needs to be "6 or GREATER" so the Applicant not view these files from the web as they can see the 1st five files.


---## keep in mind this is test data only ignore ##



DATABASE VALUES
177|0|1|Resume-Joe-Jones.doc|177_0_1.doc|
177|0|2|Joe Jones Letter of Introduction.doc|177_0_2.doc|
55|0|1|DebSmith-Resume.doc|55_0_1.doc|
55|0|2|DebSmith IntroLetter.pdf|55_0_2.pdf|
5996|0|1|Sarah_Palin-Resume.doc|5996_0_1.doc|
5996|0|6|References_5996_0_1.doc|5996_0_6.doc|


the District Scans in information on to PDF or Word Documents and places then in a STAGING AREA for EACH applicant with the file naming convention:
STAGED DOCUMENTS
<DESC>_<APPID>_<ITERID>_<DOCID>.ext
LOR1_177_0_1.doc
LOR2_177_0_2.doc
LOR1_55_0_1.doc
TRANSCRIPT_55_0_1.pdf
LOR1_5996_0_1.doc
TRANSCRIPT_5996_0_2.doc

I need to take the documents in this staging area build an insert file to check values in the table.
the key fields at "DOCID" "APPID" and
"STORENAME" I need to increment in the SARAH PALIN STAGED FILE:
TRANSCRIPTS_5996_0_1.doc
and build a record to insert into the database looking like this
5996|0|7|TRANSCRIPTS_5996_0_1.doc|5996_0_7.doc|

Since the "DOCID" FOR APPID 5996 already is valued at "6" I increment by 1. If the value in the table is Less then 6 or is null the value would be "6"

So when I am done with the script the values in the TABLE FOR APPID 5996 should look like this:

5996|0|1|Sarah_Palin-Resume.doc|5996_0_1.doc|
5996|0|6|References_5996_0_1.doc|5996_0_6.doc|
5996|0|7|TRANSCRIPTS_5996_0_1.doc|5996_0_7.doc|




In my previous script I would move off any scanned items to a backup location, and new files would receive a "counter"

while [[ -f ${distpath}${appID}/${distID}_${appID}_${docID}.${ext} ]]
do
(( docID += 1 ))
if (( docID > 99 )); then
echo "ERROR: docID too high!"
exit 2
fi
done

I essential need to do the same thing except against the check file from the database...

Last edited by rmuledeer; 02-09-2009 at 03:29 PM..
# 2  
Old 02-09-2009
I have found a solution.. When I complete it I will post here.. Disregard question..
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Red Hat

System Admin related document with example

Hi, I am looking for perfect document.which is covered all the admin role with examples..... --> Please say that "search in google"...... Can you please help on this.... Thanks & Regards, Mani (3 Replies)
Discussion started by: Mani_apr08
3 Replies

2. Red Hat

Document management supported by RH?

Hello, I would like to know if exists any document management (KM) similar to Sharepoint, OpenKM... supported by Redhat 5. Thanks! (0 Replies)
Discussion started by: RuBiCK
0 Replies

3. UNIX for Advanced & Expert Users

UNIX System Admin Document

Hi all I am trying to document my entire system (hardware/software/admin) Is there a template I could use for the purpose. This document will be the used by all System admins/ Management the company when they want to find out anyting about any of the servers we manage. If there is no such... (6 Replies)
Discussion started by: skotapal
6 Replies
Login or Register to Ask a Question