- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "if" cron entries under MC / Service Guard
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
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
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
12-20-2006 01:26 AM
12-20-2006 01:26 AM
I have 2-node cluster with common EVA storage and these nodes have identical crons with the lines like:
# Run the Log Rollover utility each night
0 0 * * * [ -d /apps/cron_APP ] && APP_DIR=/apps/inst2/app;export APP_DIR;APP_DIR/bin/startlogroll >> $APP_DIR/logs/logroll.log 2>&1
where /apps is a filesystem mounted by SG and cron_APP is a dir created specially for this "if" construction. But nevertheless the mail of the cron owner is plugged with the messages like:
***
Subject: cron
Content-Length: 366
Status: RO
sh: /logs/logroll.log: Cannot create the specified file.
*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:
[ -d /apps/cron_APP ] && APP_DIR=/apps/inst2/app;export APP_DIR;APP_DIR/bin/startlogroll >> $APP_DIR/logs/logroll.log 2>&1
I receive this messages on the node where the /apps filesystem is UNMOUNTED, so the part after && should not be executed at all, but cron tries to execute it anyway...
What could be wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2006 01:35 AM
12-20-2006 01:35 AM
Re: "if" cron entries under MC / Service Guard
Check this thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=820393
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2006 01:38 AM
12-20-2006 01:38 AM
SolutionThe semicolon before the 'export' terminates the conditional nature. I think you want something like this:
[ -d /apps/cron_APP ] && { APP_DIR=/apps/inst2/app;export APP_DIR;APP_DIR/bin/st
artlogroll >> $APP_DIR/logs/logroll.log 2>&1; }
Note the semicolon at the end of the sequence before the closing curly brace.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2006 01:44 AM
12-20-2006 01:44 AM
Re: "if" cron entries under MC / Service Guard
Three comments:
1) Check if /apps/cron_APP exists as a directory on the root filesystem. If it does, [ -d /apps/cron_APP ] would return 1.
2) I don't see why you need to perform variable substitution here. Just use explicit references to $APP_DIR:
0 0 * * * [ -d /apps/cron_APP ] && /apps/inst2/bin/startlogroll >> /apps/inst2/app/logs/logroll.log 2>&1
3) You have an error in your crontab entry:
...APP_DIR/bin/startlogroll...
should be:
...$APP_DIR/bin/start/logroll...
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2006 02:48 AM
12-20-2006 02:48 AM
Re: "if" cron entries under MC / Service Guard
Thanks very much, that's what I needed indeed. I corrected the crontab and I'll check tomorrow if the logs are OK.
2 Spex:
As far as I know test [ -d ... ] statement returns 0 if the statement is true and 1 if it does not find anyting...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2006 09:56 PM
12-20-2006 09:56 PM