0

I have a cronjob which is scheduled to run every 4 mins.Cron is running properly but it fails to execute the .sh file it supposed to run.Cron rule is following :

*/15 * * * * cd /var/www/html/etl_project && ./run_etl_incomplete.sh >> /var/www/html/etl_project/cron_log.txt 2>&1

in cron_log.txt i am getting the following permission denied error :

/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
/bin/sh: 1: ./run_etl_incomplete.sh: Permission denied
AL-zami
  • 8,902
  • 15
  • 71
  • 130

1 Answers1

2

I presume its your own personal user that you are using for this cron, which does not have permission to execute the file. Perhaps the file was created as root user or as some other user and therefore the credentials are not set to allow your user to execute.

First - Try to check what permissions are set on the file

ls -l /var/www/html/etl_project/ | grep run_etl_incomplete.sh

Check the output to see who is the owner and group and what permissions are set.

To make the file executable -

chmod +x /var/www/html/etl_project/run_etl_incomplete.sh

This will work only if you have the correct permissions in the first place (if your user is part of the group for example) to modify the file. Once the file is made executable your cron will run.

KeithC
  • 436
  • 1
  • 6
  • 25