Example systemd startup script for FreePBX
As most distributions have moved to systemd, here's an example startup script that you may customize for your installation.
...
Contents of /etc/systemd/system/freepbx.service
Code Block |
---|
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
|
|
From there you can enable it so it starts automatically
Note that on Debian 8.1, you need to use After=mysql.service, not After=mariadb.service.
Code Block |
---|
[root@firewall ~]# systemctl enable freepbx.service
ln -s '/etc/systemd/system/freepbx.service' '/etc/systemd/system/multi-user.target.wants/freepbx.service'
[root@firewall ~]# |
|
And then start it yourself if you haven't already
Code Block |
---|
[root@firewall ~]# systemctl start freepbx
[root@firewall ~]# |
|
You can check the output of the startup with the 'systemctl status' command
Code Block |
---|
[root@firewall ~]# systemctl status -l freepbx.service
freepbx.service - FreePBX VoIP Server
Loaded: loaded (/etc/systemd/system/freepbx.service; enabled)
Active: active (exited) since Mon 2015-08-17 09:20:09 AEST; 52s ago
Process: 5020 ExecStart=/usr/sbin/fwconsole start (code=exited, status=0/SUCCESS)
Main PID: 5020 (code=exited, status=0/SUCCESS)
Aug 17 09:20:06 firewall.xrobau.com fwconsole[5020]: Running Sysadmin Hooks
Aug 17 09:20:06 firewall.xrobau.com fwconsole[5020]: Starting Asterisk...
Aug 17 09:20:06 firewall.xrobau.com fwconsole[5020]: 0/100 [>---------------------------] 0%
Aug 17 09:20:07 firewall.xrobau.com fwconsole[5020]: 33/100 [=========>------------------] 33%
Aug 17 09:20:08 firewall.xrobau.com fwconsole[5020]: 66/100 [==================>---------] 66%
Aug 17 09:20:09 firewall.xrobau.com fwconsole[5020]: 99/100 [===========================>] 99%
Aug 17 09:20:09 firewall.xrobau.com fwconsole[5020]: 100/100 [============================] 100%
Aug 17 09:20:09 firewall.xrobau.com fwconsole[5020]: Asterisk Started on 5523
Aug 17 09:20:09 firewall.xrobau.com fwconsole[5020]: Running Post-Asterisk Scripts
Aug 17 09:20:09 firewall.xrobau.com systemd[1]: Started FreePBX VoIP Server.
[root@firewall ~]# |
|