Scripts can be run manually but couldn't run with cronjobs
I am from MQ/MB technology. My requirement is to display the queue manger and broker status on daily basis.
If I manually run the script, it works fine and displays output. But when I have scheduled the same using cronjobs it shows only the queue manger status and not the broker status.
Can someone please help. I am new to Unix.
#Output through cron
#Output when run manually
Cron command
Last edited by Don Cragun; 09-18-2014 at 04:17 AM..
Reason: Add CODE tags.
This is likely to be because the cron daemon is unaware of your environment, somewhere in the script you will have to source your profile. You don't mention what unix you are using but somewhere in the script (preferably near the begining) you will have to "source" your profile.
The command should be something like;
or
You'll have to tell us the version of linux and what your shell is for us to help.
Regards
In addition to what gull04 has said, this may also help...
If you look at the links at the bottom of this thread, you find that this is a common question. And, there is a thread in the Frequently Asked Questions section of this Forum: Cron and Crontab that will probably explain what you need to know. Please start there, and if you still have questions, tell us what OS you're using, what shell you're using, and show us the output from the commands:
In all likelihood, if you give an absolute pathname to dspmq in your shell script (like you did with mqsilist), your problem will disappear.
This User Gave Thanks to Don Cragun For This Post:
Hi Gull and Don,
Thanks a lot for your quicker response.
This command works fine. And I am able to get the output of queue manger and broker status appropriately now.
Hello Lads,
I deployed a script on my mac to start and stop EC2 instances on AWS console. The script when started manually on the terminal does the expected stop and start. Problem is when i try to schedule it on a cron, it fails to recognize the AWS Keys which i set up as ENV variable by... (2 Replies)
I get a different output when i manually run the .sh script and when it is run by a cron job. Please help me ..
TMP1="/lhome/bbuser/script/wslog/sar.t1"
TMP2="/lhome/bbuser/script/wslog/sar.t2"
TMP3="/lhome/bbuser/script/wslog/sar.t3"
OUTPUT="/lhome/bbuser/script/wslog/sar.out"... (8 Replies)
i have a script running using variable defined in .profile
when i run that script manually its working
but when i run the same script through cron its giving path not found
I had defined path in .profile (3 Replies)
Hi,
I am getting this error while server booting up, not sure how to fix this. Unable to mount these file systems
/dev/md/rdsk/d51: No such device or address
Can't open /dev/md/rdsk/d51: No such device or address
/dev/md/rdsk/d51: CAN'T CHECK FILE SYSTEM.
/dev/md/rdsk/d51: UNEXPECTED... (1 Reply)
Hey all,
Just wanted to get some input on a script I am using to import files into a MySQL database.
The process is pretty simple: my main server exports these files and FTPs them. I have a script that FTPs them to the machine running that runs this script. The FTP script runs without issue... (2 Replies)
so i am pretty dumb when it comes to unix. but i am in the navy and the system i work on is unix based. and we have come across this problem.
COULD NOT FIX FILE SYSTEM WITH fsck -P, RUN fsck INTERACTIVELY! LOGGING IN AS root FOR MANUAL fsk, ENTER ^D WHEN FILE SYSTEM FIXED
(in bcheckrc)#
... (4 Replies)
I have created two scripts to call SQL scripts to do some work. The scripts was successfully executed many times by manual. When I scheduled two scripts in crontab, I gave all necessary parameters. It could start, but couldn't run through. The log file didn't give enough error info. Anyone can help... (10 Replies)
I am trying to run a sript on cron to SFTP data to a company. Private and public keys are set up.
When I run this manully it works fine, however it was failing when run on cron. I have narrowed down the problem - it fails at the code that says if the error code is 0 then continue
. . . I... (2 Replies)
Hi all,
I have a main script (called OracleCleanup) that runs some sql queries. that runs off a wrapper script which contains the sources for the login information and and JOB_HOME (the script is below). When I schedule this job in the cron the log says that it cannot open my list file, which... (4 Replies)