Is there any command line tool to convert DOC and DOCX files to PDF? If no, can it be automated by some Automator script (open-print to PDF-close)?
If you have Office:Mac 2008 Business Edition or Office:Mac 2011 Home/Business Edition, Automator actions are included with those editions. One of the Automator actions included with those versions of Office:Mac is "Convert Format of Word Documents", and one of the options in that Automator action is PDF. This page has great information about Automator and Office:Mac.
If you have Home/Student Edition instead of Business Edition, or don't have Office at all, you can accomplish it via AppleScript. Mac OS X Hints has an article about bulk converting text files to PDF via AppleScript, and the comments to that article give some options to convert DOC/DOCX to PDF via RTF. That might result in a loss of formatting or linking if you've got very complex DOC/DOCX files, but might be sufficient for files that aren't terribly complex.