Solved

AIX 7.1 file conversion and print

Posted on 2014-10-10
4
504 Views
Last Modified: 2014-10-11
We have some software running on AIX 7.1 and it outputs reports as text files to a temp folder. Each time a user requests a report, a new text file appears in the temp folder. We have no access to modify the way the program outputs the report.

We are wondering if there is a way for a script to sense a new file has been created, convert that file to a PDF and then move it to a shared folder for the users to view (they are all running windows workstations on a windows network). We need to copy the original text file to the shared drive as well.

I'm guessing ghostscript will be involved. Scripting is new to me, so I'm unsure how to sense the creation of a file, convert the file to PDF and then move the PDF and copy the text file all in one move.

Thanks for all help and suggestions!
0
Comment
Question by:kbdaemon
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 334 total points
ID: 40374070
Hi, I'm assuming you have a folder shared on you AIX machine that is accessible for your windows machines.

I would not try to 'sense' if there are new files, I would just create a script that gets triggered by cron, every 5 minutes (or every 1 minute) that moves the temp files to a 'convert' folder. Then convert all files in that 'convert' folder and move everything to the shared folder.

TMP_FOLDER=/path/to/temp
SHARED_FOLDER=/path/to/shared
CNV_FOLDER=/path/to/convert
mv ${TMP_FOLDER}/*.tmp ${CNV_FOLDER}/ 2>/dev/null
# convert command here (using enscript and ghostscript)
mv ${CNV_FOLDER}/* ${SHARED_FOLDER}/

Open in new window


Put the above in a script, make it executable and create the crontab entry:

* * * * * /home/user/script.sh

or:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/user/script.sh
0
 

Author Comment

by:kbdaemon
ID: 40374077
Well, I was going to ask the folder-sharing question later ;) and just create the folder for now, let files start hitting it since we are still using test data now anyway.

Will have to look up enscript.
0
 
LVL 20

Assisted Solution

by:carlmd
carlmd earned 166 total points
ID: 40374854
You should be aware that enscript creates a postscript file (suitable for printing), but not a pdf. You still need to convert the postscript file to a pdf.

Take a look at cifs for mounting the windows share on AIX.
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 334 total points
ID: 40374943
Note that I was already suggesting to use enscript + ghostscript to get those PDF files (see code snippet above).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now