Shell script to Move messages from one queue to another

Hello experts,

Can someone guide me to use Shell script to Move messages from queue, please?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Seth SimmonsSr. Systems AdministratorCommented:
your question is too vague
what are you trying to do?  what shell? linux?
what queue?
you need to provide more details and be specific in what you are asking
JammerulesAuthor Commented:
I am sorry for being too brief. Here is what I am planning to do. And please bear in mind my newness to MQ and Unix.

I am using Cygwin simulator to simulate Unix env. In conjunction with MQ Series, I want to write a Unix Shell script to move a message from Queue Manager A to Queue Manager B. Hope this makes a little more sense. Thanks for your quick response!
JammerulesAuthor Commented:
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

if the message is in a file, use he mv command, if not give us enough information to help you. where is that message ? file ? database ?

maybe also you can tag your question as websphere. i'm not very familiar with websphere's internals, possibly people who are will know what you're talking about
JammerulesAuthor Commented:
I have this piece of code that I want to run in Cygwin. How can I go about it? The MQ Server is installed on my local machine.

# Clear a MQ queue (
# Parameters:
#  $1=Queue manager
#  $2=Queue name

if [ $# -ne 2 ] ; then
#  Tell the user what they did wrong!
   echo "Usage:"
   echo " QMgrName QueueName"

echo "clear qlocal($2)" | runmqsc $1


Open in new window

if cygwin is installed, just launch a cygwin bash terminal and call the script using

# bash path/to/script queue_manager queue_name

Open in new window

the path to the script may be either a windows full path, a unix-style absolute path which will in fact be relative to cygwin's installation directory, or a relative path using either the windows or unix syntax

if the script is made executable, you can call it as a command without explicitely specifying "bash" on the command line. this makes no difference in terms of execution

if you use this frequently using he same queue, you can setup a windows shortcut using the above command. in this case, you'll have to specify the complete path to bash
if the above does not help, would you mind making your demand clearer

How can I go about it?

what did you try ? what did you expect ? what happened ?
Duncan RoeSoftware DeveloperCommented:
Is runmqsc a Windows command? If so, you need to find out which directory it's in and add that to PATH in your script before invoking it e.g. export PATH=$PATH:/cygdrive/c/WINDOWS/system32 (if that's where runmqsc.exe is). Case of PATH components must be exactly right.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Use the "qload" utility from MQ support pack MO03.

It can be downloaded from IBM
JammerulesAuthor Commented:
Experts - I am sorry that I could not respond timely by accepting your solutions. Unfortunately, the requirement has changed and hence there is no need for pursuing a solution to my question. As a result, I didn't try any of the solutions. I am accepting all the responses as a possible solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.