Pdf Not Generated using wkhtmltopdf using automated linux Bash Shell Script?
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_fi开发者_开发问答les/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 wkhtmltopdf
using xvfb-run
like this in a no-X environment, say, by ssh-ing to localhost and verify that the $DISPLAY
environment variable is not set:
$ xvfb-run -e /tmp/xvfb-error.log -s'-screen 0 1024x768x24' wkhtmltopdf somefile.html output.pdf
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.log
file to see if xvfb
gives any error.
It would be helpful if you can state the error message that you got when it doesn't work
精彩评论