Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I execute a .sh script using cpanel cron job

Tags:

cron

cpanel

Im very new to command line so please forgive my ignorance. I can succesfully execute my script using putty by navigating to the relevant direcotry and typing

bash app_auth.sh

I'm now trying to set this scipt to run using cPanel cron job. I have tried the following but it doesnt work:

*   *   *   *   *   /public_html/app/cron_jobs/app_auth.sh  

Any help would be appreciated..

like image 785
Luke Bream Avatar asked Jun 28 '12 11:06

Luke Bream


People also ask

Does cron use bash or sh?

Cron Uses /bin/sh By Default, Not Bash Bash ( /bin/bash ) is a common shell on most distros, and is an implementation of sh. The /bin/sh file is a symlink to an sh implementation, but it isn't always bash. On Debian based systems like Ubuntu, and on macOS, /bin/sh links to dash by default.


1 Answers

Though this thread is old but I found it unanswered hence replying.

Make sure that you have assigned execute permissions to your app_auth.sh file. Also, try setting the following cron:

* * * * * /public_html/app/cron_jobs/app_auth.sh > /home/YOUR_USER/cron.log 2>&1
like image 199
Kailash Aghera Avatar answered Sep 22 '22 17:09

Kailash Aghera