BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 14th, 2007, 12:36 PM
dfr574 dfr574 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 78 dfr574 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 35 m 14 sec
Reputation Power: 6
Script works in a Konsole / not as a cron job

Hello,

I'm running FreeBSD 6.2 with KDE 3.5.

I wrote a small script that calls acroread to convert a PDF file to a PostScript file. The script works great if I run it in the a KDE Konsole, but if I try to set it up as a cron job I receive the following error.

Code:
(acroread:2040): Gtk-WARNING **: cannot open display:


Does anyone know any way around this??

Thanks in advance.

Reply With Quote
  #2  
Old August 14th, 2007, 08:56 PM
jtalerico jtalerico is offline
Needs a pillow.... :)
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2006
Posts: 649 jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 59 m 28 sec
Reputation Power: 68
Since you are running this as a cron you will need to setup a virtual frame buffer to run the acroread in. Unless you can tell acroread to run headless? Well looking at acroread there is no option for headless.

So you can create a frame buffer by...
Code:
Xvfb :1 -screen 1 800x600x16 &


So now you have a virtual frame buffer that you can push applications into it.

Code:
       --screen=<SCREEN>

              X screen to use. Use this options to override the screen part of
              the DISPLAY environment variable.


acroread -screen :1 [options]


Let me know if this helps!
__________________
-jtalerico

Workhorse :: Quad G5 2.5Ghz 8gig's memory 7800GT DDL, 2x 2005FPW's
Portable :: MacBook Pro 15" 2gig ram

Reply With Quote
  #3  
Old August 15th, 2007, 05:51 AM
dfr574 dfr574 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 78 dfr574 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 35 m 14 sec
Reputation Power: 6
jtalerico,

Thanks for the reply. Please forgive me if I sound like an idiot.

If I issue this command at boot it will create the Virtual Frame Buffer, correct?
Code:
Xvfb :1 -screen 1 800x600x16 &



When do I use this? And what is <SCREEN>
Code:
--screen=<SCREEN>


The last part I understand. I'll edit my script using the following.
Code:
acroread -screen :1 [options]

At this point it isn't working for me because I don't fully understand the code.

Thanks for all of you're help.

Reply With Quote
  #4  
Old August 15th, 2007, 06:28 AM
jtalerico jtalerico is offline
Needs a pillow.... :)
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2006
Posts: 649 jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 59 m 28 sec
Reputation Power: 68
The SCREEN is the virtual frame buffer you created to push the application to.

You need it here:

acroread -screen :1 [options]

Reply With Quote
  #5  
Old August 15th, 2007, 07:52 AM
dfr574 dfr574 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 78 dfr574 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 35 m 14 sec
Reputation Power: 6
This is what I'm typing

[mike@BSD62 ~]$ Xvfb :1 -screen 1 800x600x16 &

[mike@BSD62 ~]$ acroread -screen :1 -toPostScript -scale -80 -shrink -optimizeForSpeed ./page1.pdf
[mike@BSD62 ~]$ (acroread:801): Gtk-WARNING **: cannot open display:


Is --screen=<SCREEN> a command? Where would it go?
Thanks for your patience.

Reply With Quote
  #6  
Old August 15th, 2007, 08:05 AM
jtalerico jtalerico is offline
Needs a pillow.... :)
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2006
Posts: 649 jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 59 m 28 sec
Reputation Power: 68
I was just showing you what the man page of acroread shows for pushing it to a different screen.

To see what i am talking about do a 'man acroread'. Maybe other versions differ?

Sure thing, let me know if you are still having problems getting it started.
Comments on this post
dfr574 agrees: Excellent advice.

Reply With Quote
  #7  
Old August 15th, 2007, 09:07 AM
dfr574 dfr574 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 78 dfr574 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 35 m 14 sec
Reputation Power: 6
Got it working!! Thanks for all of you help
This is what worked.

$ Xvfb :1 -screen 0 800x600x16 &
$ export DISPLAY=BSD62.1

acroread --screen=1 -toPostScript -scale -80 -shrink -optimizeForSpeed ./page1.pdf



Thanks again!! I would have never figured it out without your help.

Reply With Quote
  #8  
Old August 15th, 2007, 12:16 PM
jtalerico jtalerico is offline
Needs a pillow.... :)
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2006
Posts: 649 jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level)jtalerico User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 59 m 28 sec
Reputation Power: 68
Glad to see that bit helped!

Looks to be a lot of people on the web trying to automate things with acroread. Maybe post a how-to with what you learned on here.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > Script works in a Konsole / not as a cron job


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway