Question & Answer
Question
My cron job is failing, but there is no indication of root cause. How can I get more information?
|
# cat /var/adm/cron/log
root : CMD ( /usr/bin/ksh -x /tmp/testA.sh >> /tmp/testA.out 2>>/tmp/testA.err ) : PID ( 4653170 ) : Wed Aug 18 20:17:00 2021
Cron Job with pid: 4653170 Failed |
Answer
|
root@hostnameA #crontab -l
* * * * * /usr/bin/ksh -x /tmp/testA.sh >> /tmp/testA.out 2>>/tmp/testA.err # STDERR and STDOUT defined in crontab
* * * * * /usr/bin/ksh -x /tmp/testB.sh # STDERR and STDOUT handled by cron default * * * * * /usr/bin/ksh -x /tmp/testC.sh # STDERR and STDOUT handled in script * * * * * /usr/bin/ksh -x /tmp/testD.sh >/dev/null 2>&1 # SILENCE STDERR and STDOUT * * * * * /usr/bin/ksh -x /tmp/testE.sh >/dev/null # STDERR ONLY |
|
# cat /tmp/testA.sh
#!/bin/sh
touch /tmp/testA.file rm /tmp/testA.file ls -al /tmp/testA.file # cat /tmp/testB.sh
#!/bin/sh
touch /tmp/testB.file rm /tmp/testB.file ls -al /tmp/testB.file # cat /tmp/testC.sh
#!/bin/sh
touch /tmp/testC.file >> /tmp/testC.out 2>>/tmp/testC.err rm /tmp/testC.file >> /tmp/testC.out 2>>/tmp/testC.err ls -al /tmp/testC.file >> /tmp/testC.out 2>>/tmp/testC.err # cat /tmp/testD.sh
#!/bin/sh
touch /tmp/testD.file rm /tmp/testD.file ls -al /tmp/testD.file # cat /tmp/testE.sh
#!/bin/sh
touch /tmp/testE.file rm /tmp/testE.file ls -al /tmp/testE.file |
| # cat /var/adm/cron/log
root : CMD ( /usr/bin/ksh -x /tmp/testA.sh >> /tmp/testA.out 2>>/tmp/testA.err #STDERR and STDOUT defined in crontab ) : PID ( 6684978 ) : Wed Aug 18 20:52:00 2021
root : CMD ( /usr/bin/ksh -x /tmp/testB.sh # STDERR and STDOUT handled by cron default ) : PID ( 4653456 ) : Wed Aug 18 20:52:00 2021 root : CMD ( /usr/bin/ksh -x /tmp/testC.sh # STDERR and STDOUT handled in script ) : PID ( 7209426 ) : Wed Aug 18 20:52:00 2021 root : CMD ( /usr/bin/ksh -x /tmp/testD.sh >/dev/null 2>&1 # SILENCE STDERR and STDOUT ) : PID ( 5177642 ) : Wed Aug 18 20:52:00 2021 root : CMD ( /usr/bin/ksh -x /tmp/testE.sh >/dev/null #STDERR ONLY ) : PID ( 7012852 ) : Wed Aug 18 20:52:00 2021 Cron Job with pid: 4653456 Failed Cron Job with pid: 7209426 Failed Cron Job with pid: 6684978 Failed Cron Job with pid: 5177642 Failed Cron Job with pid: 7012852 Failed |
|
# cat /tmp/testA.out
(empty)
# cat /tmp/testA.err
+ touch /tmp/testA.file + rm /tmp/testA.file + ls -al /tmp/testA.file ls: 0653-341 The file /tmp/testA.file does not exist. # mail
(no mail messages from cron)
|
|
# cat /tmp/testB.out
(empty)
# cat /tmp/testB.err
(empty)
# mail
From daemon Wed Aug 18 20:52:00 2021
Date: Wed, 18 Aug 2021 20:52:00 -0500 From: daemon To: root Subject: Output from cron job /usr/bin/ksh -x /tmp/testB.sh # STDERR and STDOUT handled by cron default, root@hostnameA, exit status 2 Cron Environment:
SHELL = /usr/bin/sh PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/usr/local/bin CRONDIR=/var/spool/cron/crontabs ATDIR=/var/spool/cron/atjobs LOGNAME=root HOME=/ Your "cron" job executed on hostnameA on Wed Aug 18 20:52:00 CDT 2021
/usr/bin/ksh -x /tmp/testB.sh # STDERR and STDOUT handled by cron default produced the following output: + touch /tmp/testB.file
+ rm /tmp/testB.file + ls -al /tmp/testB.file ls: 0653-341 The file /tmp/testB.file does not exist. ***************************************************************** cron: The previous message is the standard output and standard error of one of the cron commands. |
|
# cat /tmp/testC.out
(empty)
# cat /tmp/testC.err ls: 0653-341 The file /tmp/testC.file does not exist. # mail
(no mail messages from cron)
|
| No error messages or emails for testD.sh |
|
From daemon Wed Aug 18 20:52:00 2021
Date: Wed, 18 Aug 2021 20:52:00 -0500
From: daemon
To: root
Subject: Output from cron job /usr/bin/ksh -x /tmp/testE.sh >/dev/null #STDERR ONLY, root@hostnameA, exit status 2
Cron Environment: SHELL = /usr/bin/sh PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/usr/local/bin CRONDIR=/var/spool/cron/crontabs
ATDIR=/var/spool/cron/atjobs
LOGNAME=root HOME=/ Your "cron" job executed on hostnameA on Wed Aug 18 20:52:00 CDT 2021
/usr/bin/ksh -x /tmp/testE.sh >/dev/null #STDERR ONLY produced the following output:
+ touch /tmp/testE.file
+ rm /tmp/testE.file + ls -al /tmp/testE.file ls: 0653-341 The file /tmp/testE.file does not exist. ***************************************************************** cron: The previous message is the standard output and standard error of one of the cron commands. |
| SUPPORT |
|---|
|
If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract. 1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue. 2. Capture any logs or data relevant to the situation. 3. Contact IBM to open a case: -For electronic support, see the IBM Support Community: 4. Provide a clear, concise description of the issue. - See: Working with IBM AIX Support: Describing the problem. 5. Collect a system snap with cron data. # snap -r (removes previous snap data)
# snap -aZ (excludes system dump)
# tar -cvf /tmp/ibmsupt/testcase/cron.tar -C /var adm/cron spool/cron -C /etc cronlog.conf
# ls -al /usr/sbin/cron /usr/bin/crontab /usr/bin/at > /tmp/ibmsupt/testcase/cronfiles.ls 6. Prepare the snap for upload.
# snap -c (Compress snap)
# mv /tmp/ibmsupt/snap.pax.Z /tmp/ibmsupt/yourcase#.snap.pax.Z (Rename file to associate with your case)
7. Upload all of the details and data for your case.
RECOMMENDED:
a) Attach to your case
b) Upload to the Enhanced Customer Data Repository(ECuRep)
ADDITIONAL OPTIONS:
c) Blue Diamond customer data uploads (US only)
|
Related Information
Was this topic helpful?
Document Information
Modified date:
02 August 2022
UID
ibm16482433