The absolute path was the answer.
Your explanation has added to my limited knowledge :-)
On 19/09/16 23:04, Thomas Schmitt wrote:
Clive Menzies wrote:
rsync_opts="-av --exclude-from=exclude_list --delete --delete-excluded"
rsync: failed to open exclude file exclude_list: No such file or directory (2)
The decisive difference between dialog and cron could be the
current working directory.
Try with an absolute path as parameter to --exclude-from= :
rsync_opts="-av --exclude-from=/root/uhuru_backup/exclude_list --delete
Or if you want to use the variable exclude_list, set it first.
Then evaluate it by $exclude_list in the definition of variable rsync_opts:
rsync_opts="-av --exclude-from=$exclude_list --delete --delete-excluded"
This should yield the same rsync_opts content as above line.
echo "Currently at line 17">>$log_file
/root/uhuru_backup/uhuru.daily.sh: line 17: $log_file: ambiguous redirect
Hm. To what value did you set the variable log_file ?
If i set it to "/tmp/log_file", then the echo works in dash and bash.
(We have to expect that cron uses the shell dash, whereas the dialog
shell is probably bash.)
If i set it to empty text, then dash complains
dash: 2: Syntax error: newline unexpected
-bash: syntax error near unexpected token `newline'
A blank would do it in bash but not in dash:
$ log_file="/tmp/log file"
$ echo "Currently at line 17">>$log_file
-bash: $log_file: ambiguous redirect
dash is brutal enough to really create a file "/tmp/log file".
Have a nice day :)