SSH This
SSH This

Reputation: 1929

Bash Scripting Run from rc.local

I have made a script that uses a program called Diascope, its a video slideshow program.

I am trying to run this command in 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.

All I need is to get the output of the "diascope" command, in rc.local I run encodeVideo:

/bin/bash /var/www/html/video/encodeVideo.sh > /var/www/html/video/newlog

and in newlog I can see this

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, and btw I can see the output of the processing when I manually run the encodeVideo.sh script. Why can I not capture it in this log?

Is it possible that it's not standard output, so ">" doesn't actually capture it?

Any ideas would be helpful, thanks!

Upvotes: 2

Views: 1390

Answers (2)

ruakh
ruakh

Reputation: 183241

Is it possible that it's not standard output, so ">" doesn't actually capture it?

Absolutely: it could be standard error, in which case you'd have to use 2> instead of >.

Upvotes: 2

keety
keety

Reputation: 17441

try redirecting stderr and stdout to filename

diascope -clean /mnt/videos/video$1.txt 1> /var/www/html/video/encodeVideo.log  2>&1

Upvotes: 2

Related Questions