[Unit]
Description=FreePBX VoIP Server
After=mysql.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop
ExecStopPost=killall -9 "PM2 v4.5.0: God"
# 2021-08-10: Asterisk stuff doesn't stop reliably, right after freepbx.yml
# 'install -n' completes -- hence "Unable to run Pre-Asterisk hooks, because
# Asterisk is already running" issue when freepbx.service next tries to start
# it. See pbx/tasks/freepbx.yml workarounds e.g. github.com/iiab/iiab/pull/2915

[Install]
WantedBy=multi-user.target
