Announcement

Collapse
No announcement yet.

Problems with crontab

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Problems with crontab

    When I run the command below, in a konsole, it copies my Thunderbird profile to a backup disk and appends the current date to the file name.

    Code:
    cp -r /home/specialed/.thunderbird/b61br7fd.default /media/specialed/Data_Storage/Backups/b61br7fd.default_`date +%b_%d_%Y`
    When I run the same command in crontab, it appears to work but there is no file copied to the destination folder.

    This command however does work in crontab.

    Code:
    0 0 * * * cp -r /home/specialed/.thunderbird/b61br7fd.default /media/specialed/Data_Storage/Backups/b61br7fd.default_new
    So there is apparently a problem with crontab and the append date code at the end of the command. Any thoughts?

    18.04.1, i7, 16GB RAM.
    If you think Education is expensive, try ignorance.

    The difference between genius and stupidity is genius has limits.

    #2
    Try escaping the percent chars in your command with a backslash, from the crontab man page:
    The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
    Code:
    0 0 * * * cp -r /home/specialed/.thunderbird/b61br7fd.default /media/specialed/Data_Storage/Backups/b61br7fd.default_`date +\%b_\%d_\%Y`

    Comment


      #3
      That works kubicle, thank you very much!
      If you think Education is expensive, try ignorance.

      The difference between genius and stupidity is genius has limits.

      Comment

      Working...
      X