Bash Scripting Run from rc.local

Go To StackoverFlow.com

2

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!

2012-04-05 01:38
by SSH This


2

try redirecting stderr and stdout to filename

diascope -clean /mnt/videos/video$1.txt 1> /var/www/html/video/encodeVideo.log  2>&1
2012-04-05 01:45
by keety
Nice, thank yo - SSH This 2012-04-05 02:22
bash has a shortcut for this: command &> wordglenn jackman 2012-04-05 15:03
@glennjackman So this command diascope -clean /mnt/videos/video$1.txt 1> /var/www/html/video/encodeVideo.log 2>&1 would be the same as diascope -clean /mnt/videos/video$1.txt &> /var/www/html/video/encodeVideo.log (in bash) - SSH This 2012-04-05 15:09
@SSHThis, yes -- see section 3.6.4 under http://www.gnu.org/software/bash/manual/bashref.html#Redirection - glenn jackman 2012-04-05 15:56
Awesome thanks for the doc, I will look over i - SSH This 2012-04-05 16:00


2

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 >.

2012-04-05 01:45
by ruakh
Ads