我制作了一个bash脚本,该脚本应该将文件中某些行的输出写入另一个文件,然后运行一些.plt(Gnuplot)文件:
#!/bin/bash
SPATH="/home/ssh-jump/Adafruit_Python_DHT/examples"
cd $SPATH
cat $SPATH/dht22.txt |cut -d" " -f6,8,10 > $SPATH/test.txt
gnuplot $SPATH/2h.plt
gnuplot $SPATH/8h.plt
gnuplot $SPATH/24h.plt
gnuplot $SPATH/7d.plt
gnuplot $SPATH/1m.plt
gnuplot $SPATH/3m.plt
gnuplot $SPATH/1y.plt
如果我是对的,脚本应该:
test.txt
的文件中我通过chmod + x /path/of/script.sh
启用了它,并检查了包含它的文件,但是它不起作用。它不会更新gnuplot
文件,但会更新test.txt
。我做错什么了吗?
编辑:它不起作用,是指脚本不会更新文件。 cat
命令应更新test.txt
,而gnuplot .plt
文件应更新网站上的某些.svg文件。因为我希望此过程每10分钟发生一次,所以我决定制作一个包含两个任务的脚本并为其运行cronjob。