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!

  • 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, 2012 at 21:50

2 Answers 2


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

  • 1
    and put the bi-kettle.sh script under /home/cpc?
    – gtludwig
    Nov 23, 2012 at 20:06
  • 2
    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"` Nov 23, 2012 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, 2012 at 20:15
  • no luck still... now trying without > /dev/null 2>&1
    – gtludwig
    Nov 23, 2012 at 20:25
  • try >> /tmp/my_cronjob.log 2>&1 Nov 23, 2012 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

  • yes, its permissions are 755. AFAIK it should be enough.
    – gtludwig
    Nov 23, 2012 at 19:41

You must log in to answer this question.

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