我需要注意一個特定的目錄在osx中的變化,爲了看看是否有文件上傳,當文件是在目錄裏面,我想運行一個非常基本的腳本(簡單地'編譯')。使用pdflatex TEX文件),有什麼我迄今所做的:pdflatex和shell腳本
1)launchd會監控我的目錄,這是我的test.plist文件
<plist version="1.0">
<dict>
<key>Label</key>
<string>DirMonitor</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Caffeina/Desktop/test.sh</string>
<string>path modified</string>
</array>
<key>QueueDirectories</key>
<array>
<string>/Users/Caffeina/Desktop/test_dir/</string>
</array>
</dict>
</plist>
2)test.sh:
#!/bin/sh
/usr/texbin/pdflatex -interaction=nonstopmode /Users/Caffeina/Desktop/test_dir/test.tex
3)啓動顯示器:
launchctl load /Users/Caffeina/Library/LaunchAgents/test.plist
4)測試是否所有工作正常我將文件移動到受監控的目錄中......但沒有任何事情發生。展望控制檯輸出,我可以衝這錯誤:
logger[4155] This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
logger[4155] restricted \write18 enabled.
logger[4155] entering extended mode
logger[4155] ! I can't write on file `test.log'.
logger[4155] (Press Enter to retry, or Control-D to exit; default file extension is `.log')
logger[4155] Please type another transcript file name
logger[4155] ! Emergency stop
logger[4155] ! ==> Fatal error occurred, no output PDF file produced!
com.apple.launchd.peruser.501[127] (logger[4155]) Exited with exit code: 1
我不明白爲什麼這個錯誤,任何想法?
但文件test.log不存在pdflatex在此過程中創建 – Elio 2010-12-22 15:11:47