w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
root running cron task can't read .txt file generated by www-data user

You have:

 while read -r coinfile; do

I see no indication that you're reading from $file. The command

read -r coinfile

will simply read from standard input (the -r merely affects the treatment of backslashes). In a cron job, if I recall correctly, standard input is empty or unavailable, which would explain why $coinfile is empty.

If you actually do read from $file -- for example, if your real code looks something like:

while read -r coinfile; do
done <$file

then you need to show us your entire script, or at least a self-contained version of it that exhibits the problem. Actually, you need to show us your entire script whether that's the problem or not.


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.