I am trying to generate pdf using automated bash shell script, that script after every min checks the content of a file url.txt which conatins all urls line by line and i am using wkhtmltopdf for pdf generation
But the problem is pdf is not generated in the automated process but if i manually invoke that script pdf is generated. If anyone knows the solution please provide it to me?
Code of script is:
while read line;
do
wkhtmltopdf $line /var/www/images/Upload_files/name_of_file.pdf
done < /var/www/url/url.txt
If you run it in cron then the most likely reason that it wouldn’t work is because lack of an X server. In that case one solution is to use Xvfb
Try running your
wkhtmltopdfusingxvfb-runlike this in a no-X environment, say, by ssh-ing to localhost and verify that the$DISPLAYenvironment variable is not set:If that works fine then put in in a cron job that runs every 1 minute to test whether that one liner works under cron.
Otherwise check the
/tmp/xvfb-error.logfile to see ifxvfbgives any error.It would be helpful if you can state the error message that you got when it doesn’t work