Solved

AIX 7.1 file conversion and print

Posted on 2014-10-10
4
509 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

813 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

17 Experts available now in Live!

Get 1:1 Help Now