ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » MH05 in CRONTAB raising an error

Post new topic  Reply to topic Goto page 1, 2  Next
 MH05 in CRONTAB raising an error « View previous topic :: View next topic » 
Author Message
belchman
PostPosted: Mon May 11, 2015 7:27 am    Post subject: MH05 in CRONTAB raising an error Reply with quote

Partisan

Joined: 31 Mar 2006
Posts: 386
Location: Ohio, USA

I have MH05 installed an running on an AIX system. It seems to be working OK when I run it on the command line and via CRONTAB. However, when running in crontab I get an error sent to my mail system from crontab.

I have a script named /home/mqm/ev_mon/mq_slm.sh that seems to run without issue when I execute it from the command line.

I have the above script wrapped with ev_mon.sh and entered in crontab.

I do not want to bombard all with my code unless someasks for it.

In crontab, it appears to work ok in that it is generating my files for me when the process invokes ${execPath}/xmqdspev.sh -m MQPING -d -q ${queue} -f ${logPath}/${queue}_${fileExt}. However, it is raising this and mailing it to me:

Subject: Output from cron job /home/mqm/ev_mon/ev_mon.sh > /home/mqm/ev_mon/ev_mon.log, mqm@saflokydcetsa01.info53.com, exit status 0

Cron Environment:
SHELL = /usr/bin/sh
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin
CRONDIR=/var/spool/cron/crontabs
ATDIR=/var/spool/cron/atjobs
LOGNAME=mqm
HOME=/home/mqm

Your "cron" job executed on saflokydcetsa01.info53.com on Mon May 11 11:14:00 EDT 2015
/home/mqm/ev_mon/ev_mon.sh > /home/mqm/ev_mon/ev_mon.log


produced the following output:

/home/mqm/ev_mon/mq_slm.sh[45]: Xmqdspev: not found


I can live with the exception being raised and eaten but I do not want to fill up the mailbox.

Question 1: Why am i getting the error?
Question 2: If I cannot make the error go away, how can I stop crontab from sending the mail?

I am not the AIX engineer. I am the middlware engineer that is doing the MQ work.

Regards,



Any help is appreciated.
_________________
Make three correct guesses consecutively and you will establish a reputation as an expert. ~ Laurence J. Peter
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 11, 2015 7:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You probably need to make sure that setmqenv is applied in the shell running the command from crontab
Back to top
View user's profile Send private message
tczielke
PostPosted: Mon May 11, 2015 8:41 am    Post subject: Re: MH05 in CRONTAB raising an error Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

belchman wrote:
Question 2: If I cannot make the error go away, how can I stop crontab from sending the mail?


We end our crontab script entries on Solaris/Linux with the following:

> /dev/null 2>&1

This will discard both standard out and standard error for the crontab script run.
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 11, 2015 9:00 am    Post subject: Re: MH05 in CRONTAB raising an error Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

tczielke wrote:
belchman wrote:
Question 2: If I cannot make the error go away, how can I stop crontab from sending the mail?


We end our crontab script entries on Solaris/Linux with the following:

> /dev/null 2>&1

This will discard both standard out and standard error for the crontab script run.

Sure and how do you get alerted if for some reason the script fails?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon May 11, 2015 9:15 am    Post subject: Re: MH05 in CRONTAB raising an error Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

belchman wrote:

Your "cron" job executed on saflokydcetsa01.info53.com on Mon May 11 11:14:00 EDT 2015
/home/mqm/ev_mon/ev_mon.sh > /home/mqm/ev_mon/ev_mon.log


produced the following output:

/home/mqm/ev_mon/mq_slm.sh[45]: Xmqdspev: not found[/i]


This would tell me that even though the script itself was run it did not complete correctly as one of the commands could not be executed...
See mqjeff's take on the reason why...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
belchman
PostPosted: Mon May 11, 2015 10:19 am    Post subject: Reply with quote

Partisan

Joined: 31 Mar 2006
Posts: 386
Location: Ohio, USA

Here are my responses:

MQJEFF, I will look into how to do that.

tczielke, I had that and it still generated mail via CRON. I have both entries in cron. The one I posted here was my attempt to get detail about what is happening

fjb_saper: I will try to follow mqjeffs advice

all - stand by and I will let you know how it comes out.

Thanks
_________________
Make three correct guesses consecutively and you will establish a reputation as an expert. ~ Laurence J. Peter
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 11, 2015 10:21 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

belchman wrote:
MQJEFF, I will look into how to do that.

just add the right setmqenv command to your ev-mon.sh
Back to top
View user's profile Send private message
belchman
PostPosted: Mon May 11, 2015 10:43 am    Post subject: Reply with quote

Partisan

Joined: 31 Mar 2006
Posts: 386
Location: Ohio, USA

As to the setmqenv, the first hit I got when searching 'setmqenv' was http://www-01.ibm.com/support/knowledgecenter/#!/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q083560_.htm

And it says "If you have installed WebSphere MQ V 7.0.1, do not use the setmqenv command"

Guess what version I am running. You guessed it 7.0.1.9. Yeah I know it is soon out of support. This thing I am working on is part of our MQv8 upgrade.

I just need to develop this solution at the same time as the other MQ engineer that is running with the customer facing upgrades.

What is the worst thing that can happen if I run setmqenv in my script ev_mon.sh? Can I possible rock my world? This system is not yet a dual-version MQ system yet. It will likely be one of the last converted. Its not a test system not a prod system. Its our team system we use to run the shop. So wrecking MQ on it would be troubling.

I will go see if I can read setmqenv now to see what it would do if I ran it.
_________________
Make three correct guesses consecutively and you will establish a reputation as an expert. ~ Laurence J. Peter
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 11, 2015 11:18 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

if you are running in a dual environment and one of then is still 7.0.1, there is no problem in running setmqenv... however you want to make sure you run it from the highest environment and you use the form -m QMGRNAME.

This way the environment will match the queue manager you are going to work with. And you need to run it each time when switching qmgr to work with...

Word of caution: This can become time consuming when running a script against multiple queue managers at different versions... and when running on Unix / Linux make sure you follow the doc and source the setmqenv / createmqenv script where necessary.

Like always your mileage will vary.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
belchman
PostPosted: Mon May 11, 2015 11:27 am    Post subject: Reply with quote

Partisan

Joined: 31 Mar 2006
Posts: 386
Location: Ohio, USA

I am currently NOT running in a dual env. I am solely v7.0.1.9. So there is no setmqenv. At least I did not find one in the /opt, /var, or /usr directory trees.

I am going to pause this and speak to my associate to see if he wants to make this system a v7.0.1.9/v8.0.* dual-ver system. I assume once that is done,I will have a setmqenv.

I have not been doing MQ work for c.5 yrs now and the setmqenv script is foreign to me. I think I know what it is for but I have never used it.
_________________
Make three correct guesses consecutively and you will establish a reputation as an expert. ~ Laurence J. Peter
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 11, 2015 11:47 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So your cron job likely doesn't inherit from the same environment that your user does. Or at least, the cronjob enherits much much sooner.

Again, you should modify your env_mon.sh to set the necessary MQ variables.

You can log in as your user, and then get all the necessary MQ environment variables from the environment, and copy them to the shell file.
Back to top
View user's profile Send private message
belchman
PostPosted: Mon May 11, 2015 12:08 pm    Post subject: Reply with quote

Partisan

Joined: 31 Mar 2006
Posts: 386
Location: Ohio, USA

Thx MQJeff

I tried my best to get a good path to the CRON'd script. Immediately below is the exact source of that script. I appended what I thought needs to be in the path from the output of my env command (two below)

The (apparent) class that is not found is in the jar that comes with the support pac.

Whats truly bizarre is it appears to be working as i expect except that exception is being raised for some reason.

Script test
#!/usr/bin/ksh
export PATH=$PATH:/usr/mqm/java/lib:/home/mqm/ev_mon:/home/mqm/ev_mon/com.ibm.xmq.events-1.5.jar:/home/mqm/bin:/usr/mqm/samp/bin:/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/bin:/usr/java5/bin
#
/home/mqm/ev_mon/mq_slm.sh SYSTEM.ADMIN.COMMAND.EVENT SYSTEM.ADMIN.CONFIG.EVENT


MQM's env
$ whoami
mqm
$ env
_=/usr/bin/env
LANG=C
LOGIN=mqm
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/mqm/bin:/usr/bin/X11:/sbin:/usr/local/bin:/usr/mqm/samp/bin:/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/bin:/usr/java5/bin:/usr/vac/bin
RES_RETRY=2
LC__FASTMSG=true
LOGNAME=mqm
RES_TIMEOUT=3
MAIL=/usr/spool/mail/mqm
LOCPATH=/usr/lib/nls/loc
USER=mqm
AUTHSTATE=files
SHELL=/usr/bin/ksh
ODMDIR=/etc/objrepos
HOME=/home/mqm
TERM=xterm
MAILMSG=[YOU HAVE NEW MAIL]
PWD=/home/mqm/ev_mon/audit
TZ=EST5EDT
A__z=! LOGNAME
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat

_________________
Make three correct guesses consecutively and you will establish a reputation as an expert. ~ Laurence J. Peter
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 11, 2015 12:11 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I would think there would be stuff in lib and include paths, as well as several MQ_* variables. but maybe I'm confused with v8 stuff.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 11, 2015 1:28 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You can't trust the mqm user's environment after you logged in. Cron will not reflect that.

Try and source the shell appropriate ~mqm/.profile* file from the default mqm login directory... in your script
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
gbaddeley
PostPosted: Mon May 11, 2015 7:23 pm    Post subject: Re: MH05 in CRONTAB raising an error Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

tczielke wrote:
belchman wrote:
Question 2: If I cannot make the error go away, how can I stop crontab from sending the mail?

We end our crontab script entries on Solaris/Linux with the following:
> /dev/null 2>&1
This will discard both standard out and standard error for the crontab script run.

Or, if you would like to keep the output for diagnostic purposes, and avoid cron sending the email, add something like this to the end of the line in crontab, to append the stdout and stderr to a log file:
>>/xyz/abc.cronlog 2>&1
The script should echo its start time so that runs are easier to find in the log:
echo "==== $0 starts at $(date)"
_________________
Glenn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General IBM MQ Support » MH05 in CRONTAB raising an error
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.