Execution problem with CRON job

HI,

I have written an executable file in unix and I was able to execute it successfully but when I called this file with cron job it was giving error like "permission denied" and "No such file or directory".

Please help in how cron calls the file and what permission is required on the file being used in executable file and/or what other issue can exist with this.

Thanks,
Vipin Kumar Rai

you getting "permission denied" or "No such file or directory" ?
How do you invoking the script when you run manually? Is it via using shell binary like

ksh script_name.sh

If yes, you probably dont have execute permission on the script. Please alter the permissions.

Hello vipin kumar rai ,

I have a few to questions pose in response first:-

  • What actual output/errors do you get? It is important to be accurate.
  • What OS and version are you using?
  • Can you share the script?
  • Can you share the cron definition?
  • Does your script call other things that are not in the $PATH

It is important to know that the $PATH for a cron job is unlikely to be the same as for an interactive session. When a cron job starts, the profiles are not run unless you explicitly call them. Perhaps you could run another very simple cron job to display the value of $PATH and compare them.

Kind regards,
Robin