I have below entries in crontab -e ,

0 16 * * * /opt/nginxstack/Dropbox-Uploader/DatabaseDumper.sh > /var/log/cron.log 2>&1
19 20 * * * /opt/nginxstack/Dropbox-Uploader/upload_dump_dropbox.sh > var/log/cron.log 2>&1

The first shell script works fine while the second doesn't get executed. I could not find anything in the log as well. can someone please help. Permissions are set correctly and /opt/nginxstack/Dropbox-Uploader/upload_dump_dropbox.sh works when run from terminal.I am running as root.

Edit: below is the code i have in upload_dump_dropbox.sh

/opt/nginxstack/Dropbox-Uploader/dropbox_uploader.sh upload /opt/nginxstack/Dropbox-Uploader/mysqldumpsvps/* /mysqlbckfromvps
  • 2
    Both cron entries clobber (overwrite anew) the /var/log/cron.log file; are you perhaps only seeing the 4pm results, and not looking between 8:19pm and 4pm? I'd recommend appending the logs or using different log files. – Jeff Schaller Jun 24 '18 at 17:43
  • I tried this now and do not see the log file itself.9 20 * * * /opt/nginxstack/Dropbox-Uploader/upload_dump_dropbox.sh > var/log/cron2.log 2>&1 – Anand G Jun 24 '18 at 17:49
  • Well, with the crontab entry in your comment, don't you need to wait til 20:09 (in whatever timezone you are in)? – nohillside Jun 24 '18 at 18:01
  • 1
    The second cro job has a redirection to a relative pathname. There might be a typo (missing / before var). That would cause the script to not execute at all, unlee that path existed in the working directory. – Kusalananda Jun 24 '18 at 18:17

When a redirection fails on the command line, the associated command is not executed.


$ echo 'hello' >nonexistent/path
/bin/sh: cannot create nonexistent/path: No such file or directory

(echo never gets to execute)

Your second cron job redirects to a relative pathname, var/log/cron.log. If that pathname is not available from the working directory of the job, this redirection will fail and the job will not execute at all.

The cron daemon should have sent the owner of the crontab an email with the error message for each execution attempt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.