I'm replacing our old
init.d Glassfish script with a
I want the ability to start/stop domains one by one, but also a quick way to start/stop all of them at once.
So far, I have this as
[Unit] Description=Glassfish4 Domain %i [Service] Type=forking ExecStart=/opt/glassfish4/glassfish/bin/asadmin --passwordfile /my/pw/file start-domain %i ExecStop=/opt/glassfish4/glassfish/bin/asadmin --passwordfile /my/pw/file stop-domain %i TimeoutStartSec=300 TimeoutStopSec=300 [Install] WantedBy=multi-user.target
This works and I can start, stop and enable a single domain like this:
systemctl start glassfish@domain1
However, I would also like to be able to stop or start all the domains like this:
systemctl stop glassfish
How can I achieve this? Also, how can I show the status of each instance of
I'm currently thinking of writing a script which is called from the
.service file and actually starts/stops the domains, using a default set of parameters if none are supplied. But this feels hacky and wrong.