Score:0

Trying to start script but keep getting error syntax error near unexpected token `stop'

ms flag
#!/bin/bash
#

case “$1” in
    start)
        echo -n “Starting Queue Manager”
                /opt/mqm/bin/strmqm QMPROD1
                sleep 10

        echo -n “Started Queue Manager”
        #
        echo “IBM ACE”
                /opt/ace-12.0.4.0/server/bin/mqsistart.bin IIBPROD1
                sleep 10

        echo “Pokrenut ACE”
        ;;
    stop)
        echo -n “Stopping IBM ACE”
                /opt/ace-12.0.4.0/server/bin/mqsistop.bin IIBPROD1

        echo -n “Stop IBM ACE”
                kill -9 'ps -ef | grep ace'

        echo -n “Ok”
        #
        echo -n “Stopping Queue: Queue Manager”
                /opt/mqm/bin/endmqm QMPROD1

        echo -n “Stop”
                kill -9 'ps -ef | grep mqm'
                sleep 10
        ;;
        $0 stop
        $0 start
   *)
        echo “Usage: $0 start | stop”
esac
exit 0

[root@ct init.d]# sh ace.sh start ace.sh: line 34: syntax error near unexpected token stop' ace.sh: line 34: $0 stop' My OS is Centos 8

jabbson avatar
sb flag
so it doesn't like the the line `$0 stop`, what does it do (especially after `;;`)?
jabbson avatar
sb flag
also if I understand your intentions with that `$0 stop` correctly, do you really want the stop command to call itself?
Boro avatar
ms flag
It was rookie mistake, i created new script with similar config, just case loop put in the end. Check answers. Thanks anyway
Boro avatar
ms flag
I created new script below, but it's new error now /opt/ace-12.0.4.0/server/bin/mqsistop: line 12: mqsistop.bin: command not found. This is when i try to start service. Any idea?
jabbson avatar
sb flag
I think that's not exactly the script you are running, because in that script it doesn't have 'mqsistop.bin', it calls 'mqsistop'. Have you tried to check the path and filename and it is exists?
Score:0
ms flag

I created new script which is similar to one above.

#!/bin/bash

start() {
   echo "Starting Queue Manager"
   /opt/mqm/bin/strmqm QMPROD1
   sleep 2
   echo -n "Started Queue Manager"
   echo -n "Starting IBM ACE"
   /opt/ace-12.0.4.0/server/bin/mqsistart IIBPROD1
   sleep 2
   echo -n "Started IBM ACE(Svaka Cast)"
}

stop() {
   echo -n "Stopping IBM ACE"
   /opt/ace-12.0.4.0/server/bin/mqsistop IIBPROD1
   sleep 2
   echo -n "Stopped IBM ACE"
   echo "stopping Queue Manager"
   /opt/mqm/bin/endmqm QMPROD1
   sleep 2
   echo "Ugasen Queue Manager"
}

case "$1" in
   start) start ;;
   stop)  stop;;
   *) echo "usage $0 start|stop" >&2
      exit 1
      ;;
esac
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.