-1

I'm trying to execute this command with rc.local:

wget http://address/file -P /root/ 2>&1 | stdbuf -o0 awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | whiptail --gauge "Progress" 6 78 0

Above command shows percentage of download some file. It works without any problem from user's shell after login but when I try run this from rc.local I get:

open /dev/tty: No such device or address

I found that "2>$1" does the problem and on: https://stackoverflow.com/questions/21786633/init-script-dev-tty-no-such-device-or-address-error-on-redirect someone suggested to replace "2>&1" with "3>&2 2>&1 1>&3 3>&-". Unfortunately it doesn't work for me.

What is more curious this command works in Ubuntu 12.04 but doesnt on 14.04.1. Do someone know how to make this command (or redirection) work?

1 Answers1

0

If it works from the shell but not from rc.local, chances are it has to do with the environment. The first thing I would do would be to replace commands with full path. For example:

/usr/bin/wget http://address/file -P /root/ 2>&1 | /usr/bin/stdbuf ...
Ricardo
  • 739
  • 5
  • 6
  • In my opinion it hasn't to do with the environment. Im sure the problem is in the redirection 2>$1. Without 2>&1, mentioned command almost works, I see dialog box but it doesn't show progress (still 0%) while wget downloads. – koralgolek Feb 01 '15 at 19:34