This cron tqsk doesn't work:

[main_usr@localhost ~]$ sudo crontab -l  -u root
0 * * * * /home/main_usr/cron_test1.sh > /home/main_usr/cron_test1_out.sh.out 2>&1

[main_usr@localhost ~]$ 


$ ls -al cron_test1.sh
-rwxr-xr-x 1 main_usr main_usr 293 Apr  8 05:12 cron_test1.sh

As you can see, there's a new line in the cron tasks. And the file exists and is executable. The task was created a day ago. It should've run once in an hour. Nonetheless, 'cron_test1_out.sh.out' hasn't been created.


  • 1
    Has root received any email from the cron daemon containing errors? – Kusalananda Apr 10 at 20:08
  • 2
    What does your script look like? Does your script run from the command line? If so, what output does it normally produce? is the cron daemon running? – hymie Apr 10 at 20:08
  • Do other cron jobs work? If not, is the cron service running? – K7AAY Apr 10 at 20:35

Cron tasks are run with /bin/sh and a blank environment, so sometimes you may need to source your bash profile or some other environment file, or optionally, include the environment variables in the cron file. PATH is usually the biggest offender. By default, path is set to /usr/bin:/bin, so if your script refers to any executables that are not in these two directories without the full path, your cron will fail. You can set any of the environment variable in the crontab with a simple KEY=VALUE, such as


I had the same issue some time ago.

Adding /bin/bash fixed it for me.


0 * * * * /bin/bash /path_to_your_script/script.sh > /output_directory

Reason: When running a shell script you have to define where the script should be executed, so probably you have to use /bin/sh, /bin/zsh or what ever to run the script within.

Cron itself does not know where to run the script.

Please also check /var/log/syslog and /var/mail/root to see the reason.

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.