[rhn-users] cron job fails

cbeerse at gmail.com cbeerse at gmail.com
Tue Apr 19 07:53:34 UTC 2005


Dominick Diorio schreef:
> Hi ,
> I am  trying to schedule this perl script with the cron scheduler but it 
> will not run when it is scheduled.
> If i run it with the at command the scripts runs fine (ftp file to dir , 
> decrypts it and ftp it to dest).

The major difference between `cron` and `at` is:
`at`-jobs get a copy of the environment as at the prompt where `at` is issued. 
You can see details if you schedule something ahead and peek in /var/spool/at/, 
there you will find a script which will run to do you at-job. Just read it and 
see what `at` does for you.

`cron`-jobs get a verry clean environment: a verry basic environment (like a 
limited $PATH and such) and running from your homedir (or /). Just create a 
cron-job that does an `env` and a `set` to see what is defined. Most systems 
even donnot source .profile (or .login/.cshrc) before running a cronjob.

If you test with `at` and like to run it with `cron`, just copy the 
/var/spool/at/<your-job> to a script-directory and give it a decent name. Then 
call that from your cron entry.


> When running thru  the cron scheduler I get pgp decryption failed  
> return code -1 and the messaage
> Can't exec "pgp": No such file or directory at  (user/homedir/). The 
> first part of the script worked (file is ftp into the users
> working dir) .
> If i look in the home dir the file is there. I am new at this . What am 
> i missing??

Most likely the $PATH is not set as you think it is with `cron`.


CBee




More information about the rhn-users mailing list