GeneralConversion from PS to PDF in Shell Script fails

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
bjoern
Posts: 1
Joined: Sun Sep 01, 2013 11:24 pm

Conversion from PS to PDF in Shell Script fails

Post by bjoern »

Hello,

I'm new in LaTeX and try to create invoices automatically per month.

I wrote a little shell script with do some logical things, now, I don't know why, my shell script crashes by ps2pdf.

Code: Select all

#!/bin/bash
#
#

SOURCE=control_file
TARGET=invoices
TEX=becker-it_invoice.tex
TIMESTAMP=`date +%s`

if [ ! -e $SOURCE ]
then
	echo "$SOURCE existiert nicht"
	exit
fi

if [ -e LOCKED ]
then
	echo "System ist blockiert"
	exit 1
fi

if [ `find . -maxdepth 1 -name 'new_invoice*' | wc -l` -gt 0 ]
then
	rm new_invoice*
fi

export IFS=$'\n'

for CUSTOMER in `cat $SOURCE`
do
	name=`echo $CUSTOMER | cut -d';' -f 1`
	firma=`echo $CUSTOMER | cut -d';' -f 2`
	strasse=`echo $CUSTOMER | cut -d';' -f 3`
	ort=`echo $CUSTOMER | cut -d';' -f 4`
	summe=`echo $CUSTOMER | cut -d';' -f 4`
	pos1=`echo $CUSTOMER | cut -d';' -f 5`
	pos1_eur=`echo $CUSTOMER | cut -d';' -f 6`
	pos2=`echo $CUSTOMER | cut -d';' -f 7`
	pos2_eur=`echo $CUSTOMER | cut -d';' -f 8`

	cp $TEX new_invoice_${TIMESTAMP}_${TEX}
	TEX=`echo new_invoice_${TIMESTAMP}_${TEX} | sed 's/\.tex//g'`

	sed -i "s/%%FIRMA/$firma/g" $TEX.tex
	sed -i "s/%%STRASSE/$strasse/g" $TEX.tex
	sed -i "s/%%ORT/$ort/g" $TEX.tex

	latex $TEX.tex
	dvips $TEX.dvi
	ps2pdf $TEX.ps

	if [ -e $TEX.pdf ]
	then
		if [ ! -e $TARGET/`date +%Y_%m`/$firma ]
		then
			mkdir -p $TARGET/`date +%Y_%m`/$firma/files
			ARCHIV=$TARGET/`date +%Y_%m`/$firma
			FILES=$TARGET/`date +%Y_%m`/$firma/files
		else
			ARCHIV=$TARGET/`date +%Y_%m`/$firma
			FILES=$TARGET/`date +%Y_%m`/$firma/files
		fi
		
		cp $TEX.pdf $ARCHIV
		if [ $? -eq 0 ]
		then
			rm $TEX*
		fi
	else
		echo "Beim erstellen der Rechnung `date +%Y_%m` $firma ist ein Fehler aufgetreten"
		touch LOCKED
		exit 1
	fi
done 
The weird thing is that I can execute the command with success manually.

I receive a "Only -P or -P- is allowed.". It produces this log.

Code: Select all

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
 restricted \write18 enabled.
entering extended mode
(./new_invoice_1378070417_name-it_invoice.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
aded.
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrlttr2.cls
Document Class: scrlttr2 2012/05/15 v3.11 KOMA-Script document class (letter)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2011/03/09 v3.09 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2012/05/15 v3.11 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) (/usr/share/texlive/texmf-dist/tex/latex/koma-script/DIN.lco)
(/usr/share/texlive/texmf-dist/tex/latex/ubuntu/ubuntu.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
(/usr/share/texlive/texmf-dist/tex/generic/babel/ngermanb.ldf
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def)

Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `ngerman'
(babel)                I will use the patterns loaded for \language=0 instead.

)) (/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)
(/usr/share/texmf/tex/latex/lm/lmodern.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/tools/tabularx.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/array.sty))
(/usr/share/texlive/texmf-dist/tex/latex/colortbl/colortbl.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvips.def)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def)))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)))
(/usr/share/texlive/texmf-dist/tex/latex/marvosym/marvosym.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
No file new_invoice_1378070417_name-it_invoice.aux.
(/usr/share/texmf/tex/latex/lm/t1lmss.fd)

Class scrlttr2 Warning: Deprecated usage of \firsthead.
(scrlttr2)              You should use \setkomavar{firsthead}
(scrlttr2)              instead of \firsthead on input line 55.

(/usr/share/texlive/texmf-dist/tex/latex/koma-script/DIN.lco)

Class scrlttr2 Warning: Deprecated usage of \firstfoot.
(scrlttr2)              You should use \setkomavar{firstfoot}
(scrlttr2)              instead of \firstfoot on input line 107.

Foldmarks: yes
Head of first page
<img/name-it_01.eps>
Overfull \vbox (8.15947pt too high) detected at line 160
<img/name-it_01.eps>

Class scrlttr2 Warning: head of first page is 8.15947pt too high.
(scrlttr2)              You have to change `firstheadvpos'
(scrlttr2)              or you have to define a smaller
(scrlttr2)              head of first page using \setkomavar.
(scrlttr2)              Because of this too high head of first page
(scrlttr2)              you've got an overfull \vbox message on input line 160.


Foot of first page
(/usr/share/texmf/tex/latex/lm/ot1lmr.fd)
(/usr/share/texmf/tex/latex/lm/omllmm.fd)
(/usr/share/texmf/tex/latex/lm/omslmsy.fd)
(/usr/share/texmf/tex/latex/lm/omxlmex.fd)
(/usr/share/texlive/texmf-dist/tex/latex/marvosym/umvs.fd)
Address (backaddress, addressee)
Location field: yes
Title: no
Subject: before opening

Overfull \hbox (10.88788pt too wide) in paragraph at lines 172--173
[][] 
<img/signatur_01.eps> [1] (./new_invoice_1378070417_name-it_invoice.aux) )
(see the transcript file for additional information)
Output written on new_invoice_1378070417_name-it_invoice.dvi (1 page, 2292 by
tes).
Transcript written on new_invoice_1378070417_name-it_invoice.log.
This is dvips(k) 5.992 Copyright 2012 Radical Eye Software (http://www.radicaleye.com)
' TeX output 2013.09.01:2320' -> new_invoice_1378070417_name-it_invoice.ps
</usr/share/texlive/texmf/dvips/base/tex.pro>
</usr/share/texmf/fonts/enc/dvips/lm/lm-ec.enc>
</usr/share/texlive/texmf/dvips/base/texps.pro>
</usr/share/texlive/texmf/dvips/base/special.pro>
</usr/share/texlive/texmf/dvips/base/color.pro>. 
</usr/share/texmf/fonts/type1/public/lm/lmss8.pfb>
</usr/share/texmf/fonts/type1/public/lm/lmssbx10.pfb>
</usr/share/texmf/fonts/type1/public/lm/lmss10.pfb>
</usr/share/texlive/texmf-dist/fonts/type1/public/marvosym/marvosym.pfb>
</usr/share/texmf/fonts/type1/public/lm/lmss9.pfb>[1<./img/name-it_01.eps>
<./img/signatur_01.eps>] 
Only -P or -P- is allowed.

ps2pdf new_invoice_1378070417_becker-it_invoice.ps 
echo $?
0

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Conversion from PS to PDF in Shell Script fails

Post by localghost »

Any good reason why you are not compiling directly with PDFLaTeX?


Best regards and welcome to the board
Thorsten
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Conversion from PS to PDF in Shell Script fails

Post by Johannes_B »

I suggest to use pdflatex directly, too. It's a bit cleaner.

Additionally, there are some warnings in your letter. You should fix that, if all your letters are the same.

Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply