Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #172508

Re: Crontab doesn't complete a script

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: Crontab doesn't complete a script
Date 2016-09-20 00:10 +0200
Message-ID <sjeVb-2T2-17@gated-at.bofh.it> (permalink)
References <sje8N-2jK-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Clive Menzies wrote:
>     rsync_opts="-av --exclude-from=exclude_list --delete --delete-excluded"
>         exclude_list=/root/uhuru_backup/exclude_list
> 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 --delete-excluded"

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:

  exclude_list=/root/uhuru_backup/exclude_list
  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 says
  -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 :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Longstanding rsync script no longer excludes Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-17 12:50 +0200
  Re: Longstanding rsync script no longer excludes Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2016-09-17 14:30 +0200
  Re: Longstanding rsync script no longer excludes - SOLVED Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-17 18:20 +0200
    Crontab doesn't complete a script - was Re: Longstanding rsync script  no longer excludes Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-19 13:20 +0200
      Re: Crontab doesn't complete a script "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-19 13:40 +0200
        Re: Crontab doesn't complete a script Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-19 23:20 +0200
          Re: Crontab doesn't complete a script - SOLVED Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-20 00:00 +0200
          Re: Crontab doesn't complete a script "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-20 00:10 +0200
            Re: Crontab doesn't complete a script Clive Menzies <clive@clivemenzies.co.uk> - 2016-09-20 01:10 +0200

csiph-web