Solved

AIX 7.1 file conversion and print

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

Accepted Solution

by:
Gerwin Jansen, EE MVE 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 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LINUX ZIP - UNCOMPRESS WINDOWS PATH 3 109
Debugging a shell script 3 37
Shell script issue 4 56
Understanding ping command in Ubuntu 5 35
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

696 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