简体   繁体   English

使用ssh远程处理文件

[英]process a file remotely using ssh

I have this report.tex file which I convert to pdf as follows: 我有这个report.tex文件,我将其转换为pdf,如下所示:

latex report.tex
dvips report.dvi -o report.ps
ps2pdfwr report.ps report.pdf

These commands are placed in a file called linux_build 这些命令放置在名为linux_build的文件中

This works great. 这很好。 However, this works on my Linux machine and most of my work I do on my Mac 但是,这可以在我的Linux机器上工作,而我在Mac上所做的大部分工作

I checked out MacTex which is enormous (> 4GB) so I decided to process the latex file remotely (so working on my Mac, and building on my Linux computer). 我签出了巨大的MacTex (大于4GB),因此我决定远程处理乳胶文件(因此可以在Mac上运行,也可以在Linux计算机上构建)。 Like this: 像这样:

ssh latex@192.168.2.8 "cd build && ./linux_build" < report.tex
scp latex@192.168.2.8:build/report.pdf .

All this works, except for one thing: 所有这些工作,除了一件事:

latex report.tex

That command simply looks on disk, not for some input stream/pipe of whatever. 该命令只是在磁盘上查找,而不是查找任何输入流/管道。 It is at this point I'm not sure anymore how to fix this. 此时,我不确定如何解决此问题。 Any suggestions ? 有什么建议么 ?

scp report.tex latex@192.168.2.8:/home/Jeanluca/build
ssh latex@192.168.2.8 "cd build && ./linux_build" < report.tex
scp latex@192.168.2.8:build/report.pdf 

Try sending your tex file over first. 首先尝试发送您的tex文件。 To the full path for the build directory. 到构建目录的完整路径。

I know your frustration. 我知道你的无奈。 It grew so big that I put together a small script which efficiently runs LaTeX on a remote server. 它变得如此之大,以至于我拼凑了一个小的脚本,该脚本可以在远程服务器上有效地运行LaTeX。

It prestarts LaTeX on the remote end with the preamble of the previous run such that LaTeX has already loaded the required packages and is ready to go when changed contents arrives, and starts streaming the resulting PDF file immediately (before LaTeX has finished writing to it). 它以上一次运行的序言在远程端预启动LaTeX,以使LaTeX已经加载了所需的程序包,并在更改内容到达时准备就绪,并立即开始流式生成PDF文件(在LaTeX完成向其写入之前) 。 Also dependencies (images, included source files etc.) are transparently handled. 依存关系(图像,包含的源文件等)也得到透明处理。

Maybe you too find it useful: https://github.com/iblech/sshlatex 也许您也觉得它有用: https//github.com/iblech/sshlatex

No installation is necessary. 无需安装。 Execution is simple: 执行很简单:

$ sshlatex ssh.example.org foo.tex $ sshlatex ssh.example.org foo.tex

If latex supports reading from standard input then you can do it that way. 如果latex支持从标准输入读取,则可以这样做。

Possibly just latex or maybe latex - or possibly latex /dev/stdin to fake it as a local file. 可能只是latexlatex -latex /dev/stdin会将其伪造为本地文件。

If that doesn't work then you need to transfer the file over first. 如果那不起作用,那么您需要首先传输文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM