I'm installing ActiveMQ Artemis version 2.32.0 on Ubuntu 22, I created broker, created a service file in systemd:
[Service]
User=artemis
ExecStart=/var/lib/artemis-broker/bin/artemis-service start
ExecStop=/var/lib/artemis-broker/bin/artemis-service stop
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
But whenever I start the service, it always inform:
Starting artemis-service
artemis-service is now running
Gracefully Stopping artemis-service
artemis.service: Deactivated successfully.
Please help me. How to start ActiveMQ Artemis from systemd normally?
In your [service]
section you have not specified parameter Type
which then defaults to Type=simple
. It defines the process started with ExecStart
as the main process of the service. Such definition is not suitable for artemis-service
as this process ends after the broker has been started.
Add this line to your [service]
section:
Type=forking
This acknowledges your ExecStart
program spawns a child process and this will be the main process of the service.