2
#!/bin/bash
###BEGIN INIT INFO
#chkconfig: 12345 98 13
#Provides:          ACE
#Required-Start:    $local_fs
#Required-Stop:     $local_fs
#Default-Start:     2 3 4 5
#Default-Stop:      0 1 6
#Short-Description: IBM ACE Control
#Description:       IBM-ACE
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/bin
ACE_OWNR="root"
STARTUP=/root/IBM/Startup.log
#WLOG_START=/dev/null
STOP=/root/IBM/Stop.log
touch $STARTUP
touch $STOP
/bin/chown root:root $STARTUP
/bin/chown root:root $STOP

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

stop() {
   echo "Stopiranje IBM ACE"
   /opt/ace-12.0.4.0/server/bin/mqsistop IIBPROD1
   echo "Stopiran IBM ACE"
   sleep 2
   echo "Stopiranje Queue Manager"
   /opt/mqm/bin/endmqm QMPROD1
   sleep 2
   echo "Stopiran Queue Manager"
}

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

Here is my script.I put it in runlevels 12345 as S98 and K13 But when i reboot it, only QM starts ACE stays down My OS is Centos 8.

Boro
  • 31
  • 5
  • Running the script by hand means you're running it when the OS is fully booted, your service script is started as the machine boots so some services won't be up yet. What do the logs say? – Ginnungagap Oct 19 '22 at 20:44
  • Litteraly nothing. When i reboot machine, and when connecting to machine, script in runlevels never execute. Like they are not there. – Boro Oct 20 '22 at 09:52
  • What does `systemctl status {scriptname}.service` say? – Ginnungagap Oct 20 '22 at 20:00
  • Oh, i found out that i have it as a service, but error is /etc/rc.d/init.d/hello: line 2: /root/ispis.txt: Permission denied – Boro Oct 21 '22 at 07:23
  • Do i need to disable SELinux to make it work? – Boro Oct 21 '22 at 08:48

2 Answers2

0

You probably have to work on managing your script/service via systemd.

The following URL can be used as a starting point:

https://www.suse.com/support/kb/doc/?id=000019672

Abhi
  • 1
0

I found the answer, I already have script created via systemd, and that was for Queue Manager, and in above script just deleted parts where QM was mentioned. The main and biggest change that i made was disabling SELinux in /etc/selinux/config file, Change the line SELINUX=enforcing to SELINUX=disabled, Reboot machine, and everything worked fine. Haven't found solution for starting scripts after reboot whit SELINUX enable.

Boro
  • 31
  • 5