LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   /dev/tty: No such device or address ? Answer (https://www.linuxquestions.org/questions/linux-general-1/dev-tty-no-such-device-or-address-answer-903842/)

Ram Kankanampati 09-18-2011 11:03 PM

/dev/tty: No such device or address ? Answer
 
My shell script worked fine when I run it from putty. But when I try to call same shell script from crontab, it didn't work and throws "/dev/tty: No such device or address". After I spent almost 5 hours, then fixed this error by using
GPG option "--no-tty" fixed my problem.
Here is sample command.
echo "filepassphrase" | gpg --no-tty --passphrase-fd 0 --output $newfilename -d $originalfilename

Thanks,
Ram Kankanampati
Cognizant

onebuck 09-19-2011 09:09 AM

Hi,

Welcome to LQ!

MOD suggestion;
Quote:

  • Do not post if you do not have anything constructive to say in the post.
  • When posting in an existing thread, ensure that what you're posting is on-topic and relevant to the thread. If the content of your post will interfere with the current discussion, you should start a new thread.
  • Your thread may be moved to a more appropriate forum at a moderator's discretion.

Your post has been moved to a new thread since you posted to a five year old post (resurrection) with a solution for your problem not the Original Post(OP). Please re-read the above LQ rules. You might want to re-read the entire LQ Rules set to be sure that no rules will be violated for future posts.

Again, your post is a answer to your problem not OP's. Hopefully other members may add to your thread.

greenleaf 09-21-2011 03:55 AM

Well, its nice to see that you found a solution, Ram.

Generally speaking, crontab runs with a different environment than the one that is set for your shell (e.g. bash). So various things, like environment variable values, have to be provided, otherwise commands that (implicitly) refer to those variables will not function as expected.

Of course since crontab can run whilst you are not logged in, it doesn't have an associated teletype, so the linux device /dev/tty would not be available to gpg.

A knock-on effect of the changes in environment values is that is usually best to specify full paths in your scripts.

I wonder if the error messages were coming to you via your email.


All times are GMT -5. The time now is 12:41 PM.