bash scripting cannot executed in crontab

hi guys,
i have a problem.

a week ago i made a successful crontab that execute bash scripting daily, it worked well

but now, it doesn't work at all, in the mail i have:
"
/home/jimmy/cha/scripts/cekpderr

produced the following output:

lagi jalan
/home/jimmy/cha/scripts/cekpderr: isql: command not found
nawk: can't open file /home/jimmy/cha/db/cekpderr.db
source line number 1
isi variabel var adalah
/home/jimmy/cha/scripts/cekpderr: [: =: unary operator expected
cat: cannot open /home/jimmy/cha/db/cekpderr.db
"

i wonder why suddenly the crontab cannot execute the isql command.

and...
when i execute the script manually, not with crontab, it works well and produce the expected result

i have also tried to run the crontab using another user in the same group.

please help guys...

thanks before

Check for your crontab environment i.e and compare with your shell environment where your script did successful.

thanks for helping ,

but i can't find the crontab environment like u said.

i have also tried to run the crontab using other user's login, and it still doesn't work.

is there more idea friend?

you searched the forums FAQs, you would've found this. :wink:

i think i get what u said,

the crontab env lies in "/etc/crontab"

but i am not the root

i cannot even "cat /etc/crontab"

how do i change the crontab environment SHELL to bash?

thanks

for example...... if all your needed environment seetings are done in your $HOME/.profile file:

0,30 * * * * [ -f /home/jimmy/.profile ] && . /home/jimmy/.profile && /home/jimmy/cha/scripts/cekpderr

This part in the Cron tutorial speaks to your problem:

It works from the command line but not in crontab

This is perhaps our number one complaint with cron. When you login to Unix, startup scripts setup your environment. You can see your environment with the commands "printenv" or "env". On the other hand, cron sets up only a sparse environment (See Problem with crontab for the details.)

I think that the best solution is to write shell scripts that set up their own environment and run these via cron. That's what worked in not running in cron.

In ping from cron, the user used an absolute path rather than redefining the PATH environment variable.

In this thread: Cron problem?, the user sourced the .profile file to set up the environment and it worked. But that technique caused a problem in stty: tcgetattr: Not a typewriter And I also think that it sets you up for a mysterious problem. Change .profile and your cronjobs may suddenly fail.

Check that part out and the links provided. They should point you in the right direction. Good Luck.