I am using a .service file to get IBM ACE (previously IIB) to start up when the machine does.
The mqsistart command that I need to run will only work once the IBM MQ Queue Manager it's associated with has first started up.
As I have multiple queue managers and multiple brokers on the system, I am using a parameterised file to start up MQ and another for ACE (as they need to be run under different users). The Queue Managers and Brokers have the same names.
My MQ file looks like this:
[Unit]
Description=MQ service
After=home-mqm.mount opt-mqm.mount var-mqm-errors.mount var-mqm-log.mount var-mqm-qmgrs.mount var-mqm-trace.mount var-mqm.mount mqha-WMQ-%i-data.mount mqha-WMQ-%i-log.mount
Requires=home-mqm.mount opt-mqm.mount var-mqm-errors.mount var-mqm-log.mount var-mqm-qmgrs.mount var-mqm-trace.mount var-mqm.mount mqha-WMQ-%i-data.mount mqha-WMQ-%i-log.mount
Conflicts=shutdown.target reboot.target halt.target
[Service]
User=mqm
Type=idle
RemainAfterExit=yes
KillMode=none
LimitNOFILE=65536
LimitNPROC=4096
TimeoutSec=90
ExecStart=/opt/mqm/bin/strmqm -x %i
ExecStop=/opt/mqm/bin/endmqm -r -i %i
[Install]
WantedBy=multi-user.target
And my ACE file looks like this:
[Unit]
Description=ACE service
After=var-%i-data.mount var-%i-log.mount mq@%i.service
Requires=var-%i-data.mount var-%i-log.mount mq@%i.service
Conflicts=shutdown.target reboot.target halt.target
[Service]
User=broker1
Type=idle
RemainAfterExit=yes
KillMode=none
LimitNOFILE=65536
LimitNPROC=4096
TimeoutSec=90
ExecStart=bash -c '. ~/.bash_profile; mqsistart %i'
ExecStop=bash -c '. ~/.bash_profile; mqsistop %i'
[Install]
WantedBy=multi-user.target
Installation example:
systemctl enable mq@name1
systemctl enable ace@name1
The ACE and MQ services work fine by themselves, but the problem is, the After and Requires seems to be being ignored - as when ACE tries to start the broker, the queue manager hasn't started up yet.
Either that, I guess, or they're happening too close together so even though the MQ service has finished starting the queue manager itself hasn't perhaps?
From the journalctl outputs, it looks like they both started at the same time, but the MQ one finished after the ACE one failed.
So, is there any way to make %i work in the After and Requires clauses?