- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron executing wrong file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2017 07:54 AM
06-21-2017 07:54 AM
I need assistance troubleshooting a problem running a cron job on HP-UX B.11.31. I learned that this particular entry had ceased running a few months ago and went unnoticed until this week. During troubleshooting I found that the entry was firing, yet the output seemed to be from a different script file. No matter what changes are made to the original script in question it never executes the intended commands. I've setup the cron entry to direct standard output to one file and standard error to a separate file to see what's happening as such:
13 10 21 * * * /home/hci/test.sh > /tmp/log.txt 2> /tmp/error.txt
When this entry fires, I can verify it ran by checking the log in /var/adm/cron/log and double-checking the time stamps of the output files in /tmp. It clearly ran but error.txt has output obviously from another script file in the crontab. To further prove this to myself I added a line to the other script file to touch a new file in /tmp and to output the script's file location to standard output. This time I have a new file in /tmp generated from the other script and the file location matches the script file I suspected was being run in error. Here's what I've done so far.
-Ran the original script manual to verify it's working as expected.
- Checked file permissions and ownership
-Renamed the original file
-Moved the original file
-Renamed and moved the original file
-Moved the problem entry in the crontab to another location in the file
-Removed execute permissions from the other script; the output simply said the file did not have execute permission
-Saved a copy of the crontab, removed the crontab and verified it was gone from /var/spool/cron/crontabs, reinstated the crontab
I am not the system administrator for this system. I've spoken to the admin about this and we are both out of ideas. Could someone please suggest next troubleshooting steps?
Solved! Go to Solution.
- Tags:
- crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2017 08:09 AM
06-21-2017 08:09 AM
SolutionIf this is truly your cron line:
13 10 21 * * * /home/hci/test.sh > /tmp/log.txt 2> /tmp/error.txt
You have too many entries. You have an extra * field.
The fields are:
MINUTE HOUR DAY-OF-MONTH MONTH WEEKDAY COMMAND-TO-RUN.
for a total of 6 fields.
You've got
MINUTE-(13) HOUR-(10) DAY-OF-MONTH-(21) MONTH-(*) WEEKDAY-(*) EXTRA-(*) COMMAND
The extra '*' could be causing you problems. Try removing it and see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2017 08:19 AM
06-21-2017 08:19 AM
Re: cron executing wrong file
Indeed, that was the problem. Thank you for responding.