Cron job not running successfully


New Member
Sep 22, 2022
Reaction score
Hi Guys,

Apologies if this question is silly, but I am relatively new Linux and I'm having issues getting my cron job to run.

My Cron job is as follows:

22 11 * * THU sudo su - nz /nz/support/bin/nz_genstats DBNAME -schema SCHEMANAME > FILENAME.log

The cron job does not seem to run successfully and I get the following error in an email:

su: chema: No such file or directory

I can find my output file but as expected the file is empty due to the error.

Thanks in advance :)

One of the flags for "sudo" is "-s" which is asking for which shell you want to run script under.

So what is happening here....

sudo su - (some stuff) -s chema (more stuff)

But -s is expecting something like bash, ksh, zsh, fish or csh.

Usually you don't run "sudo" in a crontab. You have two other options.

You could create a bash script which runs sudo, and call that bash script from your crontab.


Since you already have the ability to sudo anyway... just run the crontab as root.

Members online

Latest posts