Why is the cronjob below not working? As manually executed script is working, but if I put it on cron job it doesn't push through.

25 11 * * * /logs/scripts/chim/currbalance_dump.sh >> /logs/currbal.log

script is below


sftp [email protected] << SFTP
cd /home/sftpadm/BanKo/CurrBalance/
mget banko_current_balance_`date +%Y%m%d`.csv /logs/Reports/BanKo/CurrBalance

Folder is

-rwxrwxrwx 1 kycadm kycadm 174 Sep 29 09:43 currbalance_dump.sh
  • What is mget and where is it installed ( type mget )
    – Anthon
    Dec 19, 2014 at 9:44
  • Even I don't know about mget but try to give the absolute path for mget
    – Thushi
    Dec 19, 2014 at 10:58
  • Add a 2>&1 at the end of the cron (after >> /logs/currbal.log), now the log should tell you where it is failing.
    – Sreeraj
    Dec 19, 2014 at 14:55
  • mget is a sftp specific command to download multiple files.
    – Sathish
    Dec 19, 2014 at 17:49

2 Answers 2


Double check that selinux isn't the issue (as root):

audit2allow /var/log/audit/audit.log

Depending on the issue you can generate a policy to allow:

audit2allow -m local-log-script -o local-log-script.te /var/log/audit/audit.log 

Edit that so it only has what you need for your script and then generate and import the selinux policy file:

checkmodule -M -m -o local-log-script.mod local-log-script.te
semodule_package -o local-log-script.pp -m local-log-script.mod
semodule -i local-log-script.pp

I usually store all those files in /etc/selinux/custom/


Assuming you have the read/write privilege to /etc/crontab file, then it should include username in the job line as follows:

crontab -l -u username

    25 11 * * * username /logs/scripts/chim/currbalance_dump.sh >> /logs/currbal.log

User specific cron job scripts can be found at /var/spool/cron/username

Also, make sure the bash script has executable bit set on it and the user executing the script has access to the directory /logs/scripts/chim/

 chmod +x currbalance_dump.sh

You can also put all your scripts in a directory and use the run-parts utility to execute all scripts in that directory

If everything above is ok, then check if the crond daemon is running or not

service crond status
service crond start

You don't need to restart the crond daemon every time when you write a new cron job.

Also, check the user is permitted to run a cron job

less /etc/cron.allow
less /etc/cron.deny

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .