Check this list on the HiveMQ User Guide. Starting at point 10 describes, how to run HiveMQ from a run script.
Install the init script (optional)
For Debian-based linux like Debian, Ubuntu, Raspbian using init.d scripts
cp /opt/hivemq/bin/init-script/hivemq-debian /etc/init.d/hivemq
chmod +x /etc/init.d/hivemq
For Debian-based linux like Debian, Ubuntu, Raspbian using systemd
cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service
Modify /etc/init.d/hivemq (optional)
Set the HIVEMQ_HOME and the HIVEMQ_USER variable to the correct values for your system.
By default this would be:
HIVEMQ_HOME=/opt/hivemq
HIVEMQ_USER=hivemq
If you installed HiveMQ to a different directory than /opt/hivemq please point the HIVEMQ_HOME in your init script to the correct directory. Otherwise the daemon will not start correctly.
Start HiveMQ on boot (optional)
For Debian-based linux like Debian, Ubuntu, Raspbian
update-rc.d hivemq defaults
For Debian-based linux like Debian, Ubuntu, Raspbian using systemd
systemctl enable hivemq