Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

AIX 7.1 file conversion and print

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

790 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