Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 06-25-2011, 12:44 PM   #1
LQ Newbie
Registered: Apr 2004
Location: Toronto CA
Distribution: fedora
Posts: 20

Rep: Reputation: 0
How to write a loop command for pdf2djvu

How do I write a loop command to periodically check a given folder and then create a djvu file from any pdf it finds.
pdf2djvu works great but I'm looking to set up a "hot folder" for general office staff to use.
Old 06-25-2011, 09:29 PM   #2
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with (still off the hook)
Posts: 284

Rep: Reputation: 33
Well in my opinion this is what cron is for, you can just have the script to look in to that folder for new files or modified within X amount of time and convert it, then setup the crontab of the user that will execute it every X amount of minutes, days or whatever you need.
Old 06-25-2011, 10:54 PM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Which languages can you use? Can you call inotify?
Old 06-28-2011, 12:47 PM   #4
LQ Newbie
Registered: Apr 2004
Location: Toronto CA
Distribution: fedora
Posts: 20

Original Poster
Rep: Reputation: 0
This is what I have so far.
It works great except if it kick's in while someone is uploading a pdf file.
The pdf gets deleted before it's processed.

find /home/qwikchk/ -iname '*.pdf' -print0 | xargs -0 -IX pdf2djvu -o X.djvu X
mv /home/qwikchk/*.djvu /var/www/html/qwikchk/files/
rm -f /home/qwikchk/*.pdf
chown -R apache:apache /var/www/html/qwikchk/


loop, pdfs

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash: how do I write an infinite loop? stf92 Linux - Newbie 9 11-13-2010 05:23 AM
pdf2djvu centguy Linux - Software 7 08-18-2009 09:04 PM
how to write such type of loop in shell George2 Programming 4 09-14-2007 06:15 AM
for loop to retrieve info and write approbiate line of code? ati Programming 2 05-07-2006 11:07 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration