我试图每隔90秒从降价文档生成一个pdf文档。我在launchd中设置了一个任务来处理这个问题。不幸的是,我收到一个错误,宣布即使我可以从命令行调用pdflatex也找不到它。以下是ddd_publisher.sh的全部内容,它是launchd每90秒运行一次的文件:
/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd
程序每90秒运行一次,但它会将以下行写入stderr:
pandoc: pdflatex not found. pdflatex is needed for pdf output.
如果我在命令行输入pdflatex -v
,它会告诉我它已安装:
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)
这是我发布的plist文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ddd.intercontinental.publisher</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Jon/dev/intercontinental/ddd_publisher.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stderr</string>
<key>StandardOutPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stdout</string>
<key>StartInterval</key>
<integer>90</integer>
答案 0 :(得分:4)
解决方案是将pdflatex的路径添加到bash脚本中,如下所示:
#!/bin/bash
PATH=$PATH:/usr/texbin
/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd