Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My cron and scripting skills are very poor, but I need to run a job every 5 minutes by user 'cpc'. So I created a script and left it at /root.

My crontab -e entry about it is:

0-59/5 * * * * /root/bi-kettle.sh

And this script (bi-kettle.sh) is:

su cpc
cd /home/cpc/data-integration 
/bin/bash kitchen.sh -rep="01" -job="MainLoad" -user="admin" -pass="admin" -level="Basic"`

But it is not called or run at any moment. What am I missing here?

Thanks in advance!

share|improve this question
You definitely want to check a question I asked about an hour ago. It has an answer by Stephane Chazelas that explains how you can create an interactive shell that is identical to the environment your cron job will see. If you walk through his little procedure, you get a prompt and you can test your script step by step and see where it fails. unix.stackexchange.com/a/56503/16841 The only gotcha is that the first command after the procedure has to be /bin/bash, without the she-bang #!. – jippie Nov 23 '12 at 21:50
up vote 4 down vote accepted

That su is why it fails, that launches an interactive shell. Why not add it to the crontab of the cpc user instead? crontab -e -u cpc

share|improve this answer
and put the bi-kettle.sh script under /home/cpc? – gtludwig Nov 23 '12 at 20:06
I would not even use bi-kettle.sh but make this the crontab line: */5 * * * * cd /home/cpc/data-integration && /bin/bash kitchen.sh -rep="01" -job="MainLoad" -user="admin" -pass="admin" -level="Basic"` – Dennis Kaarsemaker Nov 23 '12 at 20:08
following your suggestion, I left the cpc user's crontab like this: */5 * * * * cd /home/cpc/data-integration && /bin/bash kitchen.sh -rep="01" -job="MainLoad" -user="admin" -pass="admin" -level="Basic" > /dev/null 2>&1 – gtludwig Nov 23 '12 at 20:15
no luck still... now trying without > /dev/null 2>&1 – gtludwig Nov 23 '12 at 20:25
try >> /tmp/my_cronjob.log 2>&1 – Dennis Kaarsemaker Nov 23 '12 at 20:30

What do the permissions on the script look like? ie, if you run ls -l /root/bi-kettle.sh, is the script set to be executable by root? If not, your fix may be as simple as chmod +x /root/bi-kettle.sh

share|improve this answer
yes, its permissions are 755. AFAIK it should be enough. – gtludwig Nov 23 '12 at 19:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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