gnuplot无法通过ssh命令运行 [英] gnuplot doesn't work through ssh command
问题描述
所以我有一个csv,并且我有一个plt文件.我运行gnuplot plt-file.plt
并且png诞生了.
So I have a csv, and I have a plt file. I run gnuplot plt-file.plt
and a png is born.
但是如果我运行ssh sameuser@samemachine 'gnuplot plt-file.plt'
,我会收到pngcario错误.
But if I run ssh sameuser@samemachine 'gnuplot plt-file.plt'
I get a pngcario error.
csv:sar.csv
The csv: sar.csv
time, average io writes
4/15/2014 22:28, 6.040546875
4/15/2014 22:28, 7.943100586
4/15/2014 22:29, 8.686162109
4/15/2014 22:29, 7.693891602
4/15/2014 22:30, 8.579804688
4/15/2014 22:30, 7.900537109
plt:
clear
reset
print "sar"
set terminal pngcairo transparent enhanced font "arial,25" fontscale 1.0 size 1920, 1080
set key outside bottom center box title "sar" enhanced
set key maxrows 4
set key font ",25" spacing 1 samplen 2.9 width 2 height 1
set xlabel "Time (hours)" font ",25"
set ylabel "Utilization (%)" font ",25"
set output "./sar.png"
set title "sar" font ",35"
set datafile separator ","
set timefmt "%Y-%m-%d %H:%M:%S"
set ytics font ",25"
set style line 1 lt 1 lc rgb "red" lw 4
show style line
offset = 0
starting_time = 37824
t0(x)=(offset=($0==0) ? x : offset, x - offset)
plot "./sar.csv" using (t0(timecolumn(1))/3600):2 every ::3 ls 1 t "sar" with lines
最后说明:我已经用png标志编译了gnuplot.我只需要任何一种标准的图像格式.
Final note: I've compiled gnuplot with the png flag. I just needed any sort of standard image format.
推荐答案
这意味着,当您使用ssh
登录时,可能未找到您自己编译的gnuplot.在两种情况下都键入which gnuplot
可以查看使用了哪个二进制文件.
That means, that your self-compiled gnuplot probably isn't found when you log-in with ssh
. Type which gnuplot
in both cases to see which binary is used.
通常,当使用ssh
时,会得到一个非交互式外壳,该外壳提供与登录外壳不同的配置文件,并且具有与登录外壳不同的环境变量,请参见例如为什么与手动运行相比,SSH远程命令获得的环境变量更少?.
Usually when using ssh
you get a non-interactive shell, which sources different configuration files and has different environmental variables than a login shell, see e.g. Why does an SSH remote command get fewer environment variables then when run manually?.
因此,您可以更改相应的配置文件(使用的配置文件,取决于您的分发),也可以使用gnuplot二进制文件的完整路径.
So you can either change the respective configuration files (which ones are used, depends on your distribution), or you can use the full path to the gnuplot binary.
这篇关于gnuplot无法通过ssh命令运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!