cron script won"t run

cron script won"t run

am 26.09.2006 09:46:08 von Matthew Metzger

Hello,

I have a script that works great when I run it from the command line,
but doesn't work at all when added to crontab. The strange part is that
/var/log/cron shows the job running:

Sep 26 03:39:01 cono crond[25241]: (root) CMD
(/etc/cron.3min/mail-restart.sh)


However, the log shows some other errors that may have something to do
with it.

PAM adding faulty module: /lib/security/pam_krb5.so
(root) CMD (/etc/cron.3min/mail-restart.sh)
PAM unable to dlopen(/lib/security/pam_krb5.so)
PAM [dlerror: /lib/security/pam_krb5.so: cannot open shared object file:
No such file or directory]

However, other cron jobs run just fine. So I'm not sure what is the
problem. Any help in figuring this out would be greatly appreciated.

Thanks.

-Matthew

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: cron script won"t run

am 26.09.2006 10:25:49 von Matthew Metzger

A follow up:

I fixed the PAM errors by running:
apt-get install pam_krb5

my crontab script, however, still will not run.

-Matthew



Matthew Metzger wrote:
> Hello,
>
> I have a script that works great when I run it from the command line,
> but doesn't work at all when added to crontab. The strange part is that
> /var/log/cron shows the job running:
>
> Sep 26 03:39:01 cono crond[25241]: (root) CMD
> (/etc/cron.3min/mail-restart.sh)
>
>
> However, the log shows some other errors that may have something to do
> with it.
>
> PAM adding faulty module: /lib/security/pam_krb5.so
> (root) CMD (/etc/cron.3min/mail-restart.sh)
> PAM unable to dlopen(/lib/security/pam_krb5.so)
> PAM [dlerror: /lib/security/pam_krb5.so: cannot open shared object file:
> No such file or directory]
>
> However, other cron jobs run just fine. So I'm not sure what is the
> problem. Any help in figuring this out would be greatly appreciated.
>
> Thanks.
>
> -Matthew
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: cron script won"t run

am 26.09.2006 10:30:08 von adam.bowen

Hi,

Matthew Metzger wrote:
> I have a script that works great when I run it from the command line,
> but doesn't work at all when added to crontab.

# cat /dev/sysadm/mantra
The environment from within cron is not necessarily the same as that of
an interactive shell.

> The strange part is that
> /var/log/cron shows the job running:
>
> Sep 26 03:39:01 cono crond[25241]: (root) CMD
> (/etc/cron.3min/mail-restart.sh)
>
> However, the log shows some other errors that may have something to do
> with it.
>
> PAM adding faulty module: /lib/security/pam_krb5.so
> (root) CMD (/etc/cron.3min/mail-restart.sh)
> PAM unable to dlopen(/lib/security/pam_krb5.so)
> PAM [dlerror: /lib/security/pam_krb5.so: cannot open shared object file:
> No such file or directory]

Is the PAM Kerberos package installed on your system? Does the file
/lib/security/pam_krb5.so actually exist? Perhaps something in your
script is triggering authentication through Kerberos. You could:

grep /etc/pam.d/* krb

to reveal any specific pam configurations that are trying to use
Kerberos. I can't be of much more help I'm afraid. Sticking a load of
echo statements into the mail-restart.sh script could reveal what line
in your script is causing the error.

Cheers

Adam
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: cron script won"t run

am 26.09.2006 11:05:55 von Luca Ferrari

On Tuesday 26 September 2006 10:30 Adam T. Bowen's cat, walking on the
keyboard, wrote:
> Hi,
>
> Matthew Metzger wrote:
> > I have a script that works great when I run it from the command line,
> > but doesn't work at all when added to crontab.
>
> # cat /dev/sysadm/mantra
> The environment from within cron is not necessarily the same as that of
> an interactive shell.

It is possible to specify environment variables in the crontab file, thus to
create an environment similar to the one the user work in interactive mode:

[t35@server 35]$ crontab -l
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games: /opt/gnome/bin:/opt
BASH_ENV=$HOME/.bashrc
LPDEST=stt35
MAIL=/var/mail/t35
USERNAME=""
DFENV=/home/t35/dfenv.cfg
TERMINFO=/usr/share/terminfo
DFTERMINFO=/vol1/df31d/lib/terminfo
LINES=25
COLS=80
USER=t35
DFUSER=35

10 21 * * 1-6 /your/crontab/job


Also making into your script a redirection to a log file could help finding
out what is the problem.

Luca
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: cron script won"t run

am 27.09.2006 15:29:03 von Matthew Metzger

thanks for the responses to my question. I learned from them. My problem
was that I was directly editing the /etc/crontab file instead of using
the crontab command correctly. Once I figured out how to create a cron
job in a separate text file and then add it to the crontab with "crontab
config_text.cron", it worked fine.

thanks for your help.

-Matthew



Matthew Metzger wrote:
> A follow up:
>
> I fixed the PAM errors by running:
> apt-get install pam_krb5
>
> my crontab script, however, still will not run.
>
> -Matthew
>
>
>
> Matthew Metzger wrote:
>> Hello,
>>
>> I have a script that works great when I run it from the command line,
>> but doesn't work at all when added to crontab. The strange part is
>> that /var/log/cron shows the job running:
>>
>> Sep 26 03:39:01 cono crond[25241]: (root) CMD
>> (/etc/cron.3min/mail-restart.sh)
>>
>>
>> However, the log shows some other errors that may have something to do
>> with it.
>>
>> PAM adding faulty module: /lib/security/pam_krb5.so
>> (root) CMD (/etc/cron.3min/mail-restart.sh)
>> PAM unable to dlopen(/lib/security/pam_krb5.so)
>> PAM [dlerror: /lib/security/pam_krb5.so: cannot open shared object
>> file: No such file or directory]
>>
>> However, other cron jobs run just fine. So I'm not sure what is the
>> problem. Any help in figuring this out would be greatly appreciated.
>>
>> Thanks.
>>
>> -Matthew
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html