0
#!/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

Boro
  • 31
  • 5
  • so it doesn't like the the line `$0 stop`, what does it do (especially after `;;`)? – jabbson Oct 18 '22 at 15:04
  • also if I understand your intentions with that `$0 stop` correctly, do you really want the stop command to call itself? – jabbson Oct 18 '22 at 15:15
  • It was rookie mistake, i created new script with similar config, just case loop put in the end. Check answers. Thanks anyway – Boro Oct 18 '22 at 15:20
  • 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? – Boro Oct 21 '22 at 11:21
  • 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? – jabbson Oct 21 '22 at 14:20

1 Answers1

0

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
Boro
  • 31
  • 5