Ok, finalmente resolvido. Obrigado por toda sua ajuda.
Houve outro problema: o cron lança o firefox sem variáveis env, então eu tive que definir a exibição onde trabalhar.
Aqui está o código final.
#!/bin/bash
#autor : Joan Marc Riera Duocastella.
#license : BSD i guess. I just don't care. :)
# firefox -print option depends on http://sites.google.com/site/torisugari/commandlineprint2
# it's kind of possible that a file inside de .xpi extension must be edited to get bigger pdf . Depends on the html you would like to print. Good html code does not need it.
####variables
## Date, to be used as reference on tmp files
DATE='date +%Y%m%d'
## File where all webs to report are listed
WEBSFILE="/home/marc.riera/Desktop/reports/websfile.txt" # urls to print. lines starting with # will be ignored.
## Where to store all the files.
WORKDIR="/home/marc.riera/Desktop/reports"
MAILTO="[email protected]" # other mails can be added just with a single space between
MAILTEXTFILE=$WEBSFILE
FFPROFILE="cnm-profile" #FIREFOX PROFILE - create it with firefox -ProfileManager while no other firefox instances running
##################do not edit under this line
#echo "$DATE - $0"
logger $0
TMPDIR=$WORKDIR/$DATE
test -d $TMPDIR && rm -f $TMPDIR/*.pdf|| mkdir -p $TMPDIR && echo "Create folder $TMPDIR for temporal usage"
REPORT=$WORKDIR/Report_$DATE.pdf
##firefox -print "http://fbmsgga01/ganglia/?m=cpu_report&r=month&s=descending&c=CPU+cluster&h=&sh=1&hc=4&z=small" -printmode pdf -printdelay 5 -printfile ~/Desktop/reports/test.pdf
firefoxprint (){
web2Print=$1
outputFile=$2
#echo "printing $1 on $2"
env DISPLAY=:0.0 firefox -P $FFPROFILE -no-remote -print "$web2Print" -printmode pdf -printdelay 15 -printfile $outputFile &
while [ ! -s $outputFile ]; do
sleep 1
done
}
##gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=dospdf.pdf -dBATCH ganglia.pdf test.pdf
pdfjoin (){
outputFile=$1
tempdir=$2
cd $tempdir
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=$outputFile -dBATCH 'ls -tr $tmpdir'
wait
}
sendmail (){
#echo "Sending mail"
mutt -s "Report del dia $DATE" -a $REPORT -- $MAILTO < $MAILTEXTFILE
wait
}
###################################### MAIN
#######################################
COUNTER=0
for web in 'cat $WEBSFILE|grep -v '^#'|grep -v '^$''
do
firefoxprint $web $TMPDIR/$COUNTER.pdf
let COUNTER+=1
done
pdfjoin $REPORT $TMPDIR
sendmail
exit 0
Ainda estou pronto para melhorias, mas agora ele faz o que eu preciso.