Crontab do not run on PM hours

Hi All

I have a problem, I wonder if you can help me sort it out:

I have the following entry in the cron:

00 1,13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log

But the entry only runs at

01:07

I have stopped the cron deamon, and started, but it still does not work.
Can you help figure it out what is wrong with it?

FR

The cron as posted will run at 01:00 and 13:00 .
What times do you want it to run at?

I want them to run at 01:00AM and 13:00PM

FR

Do you find the log? There is no absolute path to the log file opn_amt_gestores_credito.log so if this is a root cron the log will be created in the root directory.

Also look in /var/adm/cron/log to see if the cron ran. Look in unix mail for the owner of the crontab to see if the job produced any error output.

Is this a root cron ?

the log file is in

/home/report

directory. its not a root cron, and in /var/adm/cron/log there is no entry of any error regarding that entry.

Looking in /var/adm/cron/log , did the cron job run? Did it give a non-zero rc=? response?

Have you looked in /var/mail/<owner> for error messages?

Big question: Did you use crontab -e <user> or some other method to edit the relevant crontab file?

the one at

 CMD: /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
>  report 908 c Thu Apr 12 01:00:00 SAST 2012

runned successfully. It is in

/var/adm/cron/log

file.
There is no

/var/mail/report

file in which report is the owner.

And yes I use

crontab -e report

to edit the crontab

Is there any entry at all for the 13:00 run in the cron log?

grep "report" /usr/adm/cron/log

If the script did run, please post the contents of the script because there must be something funny in it.

If the cron did not run at all, is there anything relevant in /usr/adm/syslog/syslog.log ?
Do you have any other symptoms like commands mysteriously not working? Has the kernel been tuned since the system was installed?

from:

grep "report" /var/adm/cron/log

, I got

>  CMD: /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
>  report 908 c Thu Apr 12 01:00:00 SAST 2012
<  report 908 c Thu Apr 12 01:07:08 SAST 2012

which is right for the 01:00AM.

This is not getting us along too well. You do know that crond does NOT create environment variables for a user like login does. This will mess up a lot of otherwise good code.

So the first problem is since you are not getting errors from your redirection:

where is the log file? does it exist - post the output of:

find / -name opn_amt_gestores_credito.log -exec ls -l {} \;

Next PLEASE post your code, something odd is definitely going on.

Please also post:

# List of cron entries
crontab -l report
# Check whether someone is changing this file
ls -lad /usr/adm/cron/cron.allow
# Check what's in it at the moment (during the day)
cat /usr/adm/cron/cron.allow

that log do exist, it was created at 01:00AM as you can see from:

$ find / -name opn_amt_gestores_credito.log -exec ls -l {} \;
-rw-r--r--   1 report     users          523 Apr 12 01:07 /home/report/opn_amt_gestores_credito.log

and from:

$ crontab -l report
45 02 * * * /home/report/duo_subscribers.ksh > duo_subscribers.log
45 03 * * * /home/report/postpaid_subscribers.ksh > postpaid_subscribers.log
59 23 * * * /home/report/daily_open_amount.ksh > open_amount.log
20 0 9 1 * /home/report/ista_hlr.ksh > lista_hlr.log
10 1 9 1 * /home/report/dpworld_execure.ksh > dpworld_output.log
00 1 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
00 13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log

---------- Post updated at 01:09 PM ---------- Previous update was at 01:04 PM ----------

and sorry the code :

$ more opn_amt_gestores_credito.ksh
#!/usr/bin/ksh
export ORACLE_HOME=/fs2/ora10g
$ORACLE_HOME/bin/sqlplus dbextra/dbextra@bscsprod_node0 @/home/report/execute_Open_Amount_Gestores_Credito.sql

---------- Post updated at 01:10 PM ---------- Previous update was at 01:09 PM ----------

$ more opn_amt_gestores_credito.ksh
#!/usr/bin/ksh
export ORACLE_HOME=/fs2/ora10g
$ORACLE_HOME/bin/sqlplus dbextra/dbextra@bscsprod_node0 @/home/report/execute_Open_Amount_Gestores_Credito.sql
opn_amt_gestores_credito.ksh: END

It's 13:00 here. Have you already had 13:00 in your timezone?
Did the cron fire:

grep report /usr/adm/cron/log

yes 1:00PM or 13:00 has already gone here 1 hour and 16 minutes ago, but the second entry did not run:

00 13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log

and in /var/adm/cron/log no entry for that one, only for the 01:00AM

CMD: /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
>  report 908 c Thu Apr 12 01:00:00 SAST 2012
<  report 908 c Thu Apr 12 01:07:08 SAST 2012

Please post the output from this command while logged in as root:
It should be about 50 lines long.

/usr/sbin/sysdef

And this one:

sar -v 2 10

And the one we asked for earlier:

ls -lad /var/adm/cron/cron.allow
cat /var/adm/cron/cron.allow

When you posted grep report /usr/adm/cron/log were all the other night time jobs containing the word report missing too?
What's the timestamp on the cron log?:

ls -lad /usr/adm/cron/log

What Operating System version do you have?

uname -a

Are you up to date with HP-UX patches?

NAME                      VALUE       BOOT        MIN-MAX        UNITS   FLAGS
acctresume                    4          -       -100-100                -
acctsuspend                   2          -       -100-100                -
allocate_fs_swapmap           0          -           -                   -
bufpages                 251191          -          0-           Pages   -
create_fastlinks              0          -           -                   -
dbc_max_pct                   6          -           -                   -
dbc_min_pct                   5          -           -                   -
default_disk_ir               0          -           -                   -
dskless_node                  0          -          0-1                  -
eisa_io_estimate            768          -           -                   -
file_pad                     10          -          0-                   -
fs_async                      0          -          0-1                  -
hpux_aes_override             0          -           -                   -
maxdsiz                  262144          -          0-655360     Pages   -
maxdsiz_64bit           2097152          -        256-1048576    Pages   -
maxfiles                   2048          -         30-2048               -
maxfiles_lim               4096          -         30-2048               -
maxssiz                   32768          -          0-655360     Pages   -
maxssiz_64bit            262144          -        256-1048576    Pages   -
maxswapchunks                 0          -          1-16384              -
maxtsiz                   24576          -          0-655360     Pages   -
maxtsiz_64bit            262144          -        256-1048576    Pages   -
maxuprc                    3682          -          3-                   -
maxvgs                       10          -           -                   -
msgmap               -536870911          -          3-                   -
nbuf                     333777          -          0-                   -
nfile                     65536          -         14-                   -
ninode                    34816          -         14-                   -
no_lvm_disks                  0          -           -                   -
nproc                      4200          -         10-                   -
npty                         60          -          1-                   -
nstrpty                      60          -           -                   -
nswapdev                     10          -          1-25                 -
nswapfs                      10          -          1-25                 -
public_shlibs                 1          -           -                   -
remote_nfs_swap               0          -           -                   -
rtsched_numpri               32          -           -                   -
sema                 -536870911          -          0-1                  -
shmem                -536870911          -          0-1                  -
shmmni                      512          -          3-1024               -
streampipes                   0          -          0-                   -
swapmem_on                    1          -           -                   -
swchunk                    2048          -       2048-16384      kBytes  -
timeslice                    10          -         -1-2147483648 Ticks   -
unlockable_mem                0          -          0-           Pages   -
mceldev[298]/ #
sar -v 2 10
HP-UX mceldev B.11.23 U ia64    04/12/12
14:36:47 text-sz  ov  proc-sz  ov  inod-sz  ov  file-sz  ov
14:36:49   N/A   N/A 627/4200  0  1566/372426 0  3865/65536 0
14:36:51   N/A   N/A 629/4200  0  1567/372426 0  3870/65536 0
14:36:53   N/A   N/A 627/4200  0  1566/372426 0  3865/65536 0
14:36:55   N/A   N/A 626/4200  0  1566/372426 0  3863/65536 0
14:36:57   N/A   N/A 626/4200  0  1566/372426 0  3863/65536 0
14:36:59   N/A   N/A 626/4200  0  1566/372426 0  3863/65536 0
14:37:01   N/A   N/A 629/4200  0  1566/372426 0  3869/65536 0
14:37:03   N/A   N/A 627/4200  0  1566/372426 0  3865/65536 0
14:37:05   N/A   N/A 626/4200  0  1566/372426 0  3863/65536 0
14:37:07   N/A   N/A 627/4200  0  1566/372426 0  3865/65536 0
mceldev[299]/ #
mceldev[299]/ #ls -lad /var/adm/cron/cron.allow
-rwxr-xr-x   1 bin        bin             46 Nov 29 11:36 /var/adm/cron/cron.allow
mceldev[300]/ #cat /var/adm/cron/cron.allow
root
adm
uucp
bscsmig
ora10g
jmuchang
report
mceldev[301]/ #

and if I do

grep "report" /var/adm/cron/log

, I see everything , like all entries in the crontab -l

---------- Post updated at 03:09 PM ---------- Previous update was at 03:08 PM ----------

$ grep "report" /var/adm/cron/log
>  CMD: /home/report/daily_open_amount.ksh > open_amount.log
>  report 20938 c Wed Apr 11 23:59:00 SAST 2012
<  report 20938 c Thu Apr 12 00:02:09 SAST 2012
>  CMD: /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
>  report 908 c Thu Apr 12 01:00:00 SAST 2012
<  report 908 c Thu Apr 12 01:07:08 SAST 2012
>  CMD: /home/report/duo_subscribers.ksh > duo_subscribers.log
>  report 7746 c Thu Apr 12 02:45:00 SAST 2012
<  report 7746 c Thu Apr 12 03:09:04 SAST 2012
>  CMD: /home/report/postpaid_subscribers.ksh > postpaid_subscribers.log
>  report 11615 c Thu Apr 12 03:45:00 SAST 2012
<  report 11615 c Thu Apr 12 03:49:50 SAST 2012
$

its hp-ux 11.23

In the kernel nproc (maximum processes running on the system) is quite low at 4200 but maxuprc (maximum processes for one user) is high at 3682 . The sar shows that you have some leeway. It's not that.

If cron itself is sick we would expect messages like "queue max run limit reached" in /usr/adm/cron/log or other errors in /usr/adm/syslog/syslog.log and possibly in /var/mail/root .

Because the other jobs for account "report" ran we can eliminate expired password.

This is quite a mystery.

My best guess is that this is a HP-UX Trusted System and the account report has been restricted to certain hours of operation which don't include 13:00 .

Hi

Its not a trusted system, and the user "report" was created using sam, no restriction whatsover!! I have change the entry like

00 1,13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log

and tomorrow at 13:00PM I will check again

Probably a silly question, but did you originally have just the 01:00 definition?
If so, did you use crontab -e to edit the file, or did you just edit the file down /var/spool/cron/....... somewhere?
If you did then the cron deamon will not recognise the update.

A forced clock change with date -u can also confuse cron and you may need to stop/restart it.

If you feel that you should stop/restart it because of either of the above, check in /etc/inittab to see if it has been coded as a respawn process. I have this on AIX, but HP-UX seems to have it started with /sbin/rc2.d/S730cron. You would be best to stop start with this script if this is what you have too. Run it as root:-

#  sh /sbin/rc2.d/S730cron stop
#  sh /sbin/rc2.d/S730cron start

Of course, if this is not the case, please ignore me.

Robin
Liverpool/Blackburn
UK

initially I had

00 1,13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log

I always use the crontab -e comand

I have not stop/start the cron deamon, because the other entries in the crontab are working fine. So I had no reason to stop/start the deamon using

/sbin/init.d/cron stop