Print soffice doc with crontab

Issues with installing under all GNU/Linux Distributions
Post Reply
CWI13
Posts: 4
Joined: Tue Apr 02, 2013 6:31 pm

Print soffice doc with crontab

Post by CWI13 »

Hello,

Despite all the topics found on this forum I do not succeed in doing my cron working :

I try to print xls document to a ps printer
It works fine when using the command line as follows :
PrintXls2ps.sh
#!/bin/sh
/usr/lib/openoffice/program/soffice -p PSPRINTER /home/ftp/export/Excel/simple.xls

Then I do crontab -e (as root)
SHELL=/bin/sh
PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin
30 * * * * /usr/bin/PrintXls2ps.sh >>/home/frp/export/Excel/FileLog.txt 2>&1

I have the error
/usr/lib/openoffice.org/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)

I tried with
1- 30 * * * * /bin/sh /usr/bin/PrintXls2ps.sh >>/home/frp/export/Excel/FileLog.txt 2>&1
2- /usr/lib/openoffice/program/soffice -headless -p PSPRINTER /home/ftp/export/Excel/simple.xls
3- using source /home/"username"/.bash_profile in sh script
4- export DISPLAY:=0:0 in sh script

and nothing's working

could someone help me ?

I use etch with ooo 2.0.3
OOO 2.0.3
Debian etch
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Print soffice doc with crontab

Post by kingfisher »

If the error is in cron, I use '-display :0.0' (without the ' ' of course).
Apache OpenOffice 4.1.9 on Linux
CWI13
Posts: 4
Joined: Tue Apr 02, 2013 6:31 pm

Re: Print soffice doc with crontab

Post by CWI13 »

Hello,

So I tried this
/usr/lib/openoffice/program/soffice -display=:0.0 -headless -p PSPRINTER /home/ftp/export/Excel/simple.xls
But the same message in FileLog.txt

it is not the same as
export DISPLAY:=0:0 in sh script ?

What's wrong !!?
OOO 2.0.3
Debian etch
CWI13
Posts: 4
Joined: Tue Apr 02, 2013 6:31 pm

Re: Print soffice doc with crontab

Post by CWI13 »

Any more idea

Thanks in advance
OOO 2.0.3
Debian etch
CWI13
Posts: 4
Joined: Tue Apr 02, 2013 6:31 pm

Re: Print soffice doc with crontab

Post by CWI13 »

Hello

Is there anybody that could help me ?

Thanks
OOO 2.0.3
Debian etch
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Print soffice doc with crontab

Post by RoryOF »

Does the headless print line work on its own from the console?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply