LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

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

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
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (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
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

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

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/
 
  


Reply

Tags
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


All times are GMT -5. The time now is 01:16 AM.

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