Today, I was setting up a WildFly application server on an Amazon EC2 machine.
After som swearing and teeth grinding I discovered that the old
init.d files and
rc files has been abandoned for a
couple of years… Thanks to Ask Ubuntu user JdeBP for that.
Looking further, I went to the cornucopia of knowledge that is the
StackExchange universe. Here Oleg Gritsak suggested creating a
/etc/systemd/system/wildfly.service with the content
[Unit] Description=WildFly application server Wants=network-online.target After=network-online.target [Service] Type=simple User=web Group=web ExecStart=/opt/wildfly-10.1.0.Final/bin/domain.sh Restart=always RestartSec=20 [Install] WantedBy=multi-user.target
His answer on StackOverflow is found here.
So I removed all wildfly scripts and symlinks from
/etc/init.d and the
/etc/rc[0-6].d directories. Enabled the new
/etc/systemd/system/wildfly.service script by issuing
$ sudo systemctl enable wildfly
It did, however, not work instantly.
systemctl start wildfly did not show any output and did not
start WildFly either, but when I rebooted the EC2 instance WildFly was
(suddenly) running. Issuing
$ curl http://localhost:8080
$ less /usr/local/wildfly-12.0.0.Final/standalone/log/server.log
gave me the expected output and “my system was a GO”!