Skip to contentSkip to conversation

cron script won't run

DISCUSSION Matthew Metzger 3 participants 5 messages Sep 26, 2006 – Sep 27, 2006

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

A follow up:

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

my crontab script, however, still will not run.

-Matthew

Quoted 25 lines · 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.

(quoted diff) +0 -2
-Matthew
 
-

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

#3 lore raw
In reply to Matthew Metzger

Hi,

Quoted 2 lines · Matthew Metzger

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.
Quoted 6 lines

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)

Quoted 8 lines

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

#4 lore raw
Quoted 9 lines · walking on the keyboard,

Hi,

Quoted 2 lines · Matthew Metzger

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

#2 lore raw
In reply to 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

Quoted 43 lines · 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

Quoted 21 lines · 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.

(quoted diff) +0 -2
-Matthew
 
-
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html