One cron job doesnt work correctly


All jobs are working but not the latest.
It starts a script that produces a file. But the file is empty if i run it from cron, but if i run it manually in the same way as it is written in cron it works.

10 12 * * * /home/admin/bin/

I have tried with
10 12 * * * root /home/admin/bin/ doesn´t work

If i run it from prompt with /home/admin/bin/ it works, doesn´t matter if i run it as root or admin.

File properties:
-rwxrwxr-x 1 admin root 1185 Jan 8 12:02 DEN-lic.txt

Any suggestions why?


does the script need any special environment variables?

You can check the root mails. If the script returns any error, cron often sends
an e-mail to the user account.

Simone Truschko

Found the problem, when running as crontab you need to have the whole path to the command in the script, but you don´t need it running outside, why, i don´t know. It works :slight_smile:

Perhaps your path varible is not exported.
That is why I ask about the environment.
The environment in cronjobs is other than on the console.

Hi tzwaj,

cron jobs are run by the cron daemon, which is started upon boot and uses the environment set at that time. IOW, it has a limited environment and any user-specific settings are not part of it. It has nothing to do with "export"ing variables as a user.

You can either set up your own PATH inside your script, or fully reference the binaries outside the standard path (as you did). To check the environment context provided by cron, simply start a cron job that redirects the output of the “env” command to a file…