[英]Bash Scripting Run from rc.local
I have made a script that uses a program called Diascope, its a video slideshow program.我制作了一个脚本,该脚本使用名为 Diascope 的程序,它是一个视频幻灯片程序。
I am trying to run this command in encodeVideo.sh我正在尝试在 encodeVideo.sh 中运行此命令
echo "Running diascope -clean /mnt/videos/video$1.txt..."
diascope -clean /mnt/videos/video$1.txt > /var/www/html/video/encodeVideo.log
echo "Removing old deploy dir, and making new one..."
And I am running this script from rc.local so that it runs every time I boot the instance.我从 rc.local 运行这个脚本,以便它在我每次启动实例时运行。
All I need is to get the output of the "diascope" command , in rc.local I run encodeVideo:我只需要获取“diascope”命令的 output ,在 rc.local 中运行 encodeVideo:
/bin/bash /var/www/html/video/encodeVideo.sh > /var/www/html/video/newlog
and in newlog I can see this在 newlog 中我可以看到这个
Running diascope -clean /mnt/videos/video7.txt...
Removing old deploy dir, and making new one...
and /var/www/html/video/encodeVideo.log is completely empty, Diascope uses gawk.并且 /var/www/html/video/encodeVideo.log 完全是空的,Diascope 使用 gawk。 and btw I can see the output of the processing when I manually run the encodeVideo.sh script?顺便说一句,当我手动运行 encodeVideo.sh 脚本时,我可以看到处理的 output 吗? Why can I not capture it in this log?为什么我不能在此日志中捕获它?
Is it possible that it's not standard output, so ">" doesn't actually capture it?有没有可能它不是标准的 output,所以“>”实际上并没有捕捉到它?
Any ideas would be helpful, thanks!任何想法都会有所帮助,谢谢!
try redirecting stderr and stdout to filename尝试将stderr和stdout重定向到文件名
diascope -clean /mnt/videos/video$1.txt 1> /var/www/html/video/encodeVideo.log 2>&1
Is it possible that it's not standard output, so ">" doesn't actually capture it?有没有可能它不是标准的 output,所以“>”实际上并没有捕捉到它?
Absolutely: it could be standard error, in which case you'd have to use 2>
instead of >
.绝对:这可能是标准错误,在这种情况下,您必须使用2>
而不是>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.