mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	pbx: True 'systemctl restart freepbx' twice for #2908
This commit is contained in:
		
							parent
							
								
									c82e852526
								
							
						
					
					
						commit
						56519b7fce
					
				
					 2 changed files with 20 additions and 6 deletions
				
			
		| 
						 | 
					@ -3,9 +3,10 @@
 | 
				
			||||||
#  include: asterisk_dependencies.yml
 | 
					#  include: asterisk_dependencies.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# BEWARE: 'systemctl is-active asterix' falsely reports 'inactive' even when systemd
 | 
					# BEWARE: 'systemctl is-active asterix' falsely reports 'inactive' even when systemd
 | 
				
			||||||
# is compiled in below!  FWIW: /opt/iiab/asterisk/contrib/systemd/asterisk.service
 | 
					# is compiled in below!   FWIW: /opt/iiab/asterisk/contrib/systemd/asterisk.service
 | 
				
			||||||
 | 
					# https://github.com/asterisk/asterisk/blob/master/contrib/systemd/asterisk.service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Asterisk - Install package 'libsystemd-dev' so Asterisk compiles in imperfect-but-improving systemd support -- so '/* #undef HAVE_SYSTEMD */' becomes '#undef HAVE_SYSTEMD' in /opt/iiab/asterisk/include/asterisk/autoconfig.h -- per https://community.asterisk.org/t/systemctl-start-asterisk-is-fail-with-timeout/81123/3 and https://github.com/asterisk/asterisk/blob/master/contrib/systemd/asterisk.service
 | 
					- name: Asterisk - Install package 'libsystemd-dev' so Asterisk compiles in imperfect-but-improving systemd support -- if ./configure below places '#define HAVE_SYSTEMD 1' in /opt/iiab/asterisk/include/asterisk/autoconfig.h -- please later confirm with 'ldd /usr/sbin/asterisk | grep systemd' -- per https://community.asterisk.org/t/systemctl-start-asterisk-is-fail-with-timeout/81123/3
 | 
				
			||||||
  package:
 | 
					  package:
 | 
				
			||||||
    name: libsystemd-dev
 | 
					    name: libsystemd-dev
 | 
				
			||||||
    state: present
 | 
					    state: present
 | 
				
			||||||
| 
						 | 
					@ -67,6 +68,12 @@
 | 
				
			||||||
  args:
 | 
					  args:
 | 
				
			||||||
    chdir: "{{ asterisk_src_dir }}"
 | 
					    chdir: "{{ asterisk_src_dir }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# - name: Asterisk - Set '#define HAVE_SYSTEMD 1' in /opt/iiab/asterisk/include/asterisk/autoconfig.h
 | 
				
			||||||
 | 
					#   lineinfile:
 | 
				
			||||||
 | 
					#     path: /opt/iiab/asterisk/include/asterisk/autoconfig.h
 | 
				
			||||||
 | 
					#     regexp: '#undef HAVE_SYSTEMD'
 | 
				
			||||||
 | 
					#     line: '#define HAVE_SYSTEMD 1'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Asterisk - Run 'make menuselect.makeopts'
 | 
					- name: Asterisk - Run 'make menuselect.makeopts'
 | 
				
			||||||
  command: make menuselect.makeopts
 | 
					  command: make menuselect.makeopts
 | 
				
			||||||
  args:
 | 
					  args:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@
 | 
				
			||||||
#     dest: "{{ freepbx_install_dir }}/admin/libraries/view.functions.php"
 | 
					#     dest: "{{ freepbx_install_dir }}/admin/libraries/view.functions.php"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: FreePBX - 4-step install (just run once) - CAN TAKE 3-12 MIN OR LONGER!
 | 
					- name: FreePBX - 2-step install (just run once) - CAN TAKE 3-12 MIN OR LONGER!
 | 
				
			||||||
  command: "{{ item }}"
 | 
					  command: "{{ item }}"
 | 
				
			||||||
  args:
 | 
					  args:
 | 
				
			||||||
    chdir: "{{ freepbx_src_dir }}"
 | 
					    chdir: "{{ freepbx_src_dir }}"
 | 
				
			||||||
| 
						 | 
					@ -133,10 +133,10 @@
 | 
				
			||||||
  with_items:
 | 
					  with_items:
 | 
				
			||||||
    - ./start_asterisk start
 | 
					    - ./start_asterisk start
 | 
				
			||||||
    - ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
 | 
					    - ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
 | 
				
			||||||
    - /usr/sbin/asterisk -rx "core stop gracefully"    # 2021-08-05: For 1st run of enable-or-disable.yml, so 'systemctl status freepbx' doesn't show "Unable to run Pre-Asterisk hooks, because Asterisk is already running" -- allowing http://box:83/freepbx to connect to Asterix reliably/immediately -- even prior to the 1st reboot
 | 
					 | 
				
			||||||
    # - ./start_asterisk stop
 | 
					    # - ./start_asterisk stop
 | 
				
			||||||
    # - killall -9 safe_asterisk    # 2021-08-05: Thanks to @jvonau's PR $2912, these 2 lines attempt a (brute force for now, not enough?!) workaround to intermittent
 | 
					    # - killall -9 safe_asterisk    # 2021-08-05: These 2 lines from PR #2912 attempted a (brute force, not enough?!) workaround to frequent #2908 install
 | 
				
			||||||
    # - killall -9 asterisk         # #2908 install issue of 'systemctl status freepbx' showing "Unable to run Pre-Asterisk hooks, because Asterisk is already running"
 | 
					    # - killall -9 asterisk         # annoyance 'systemctl status freepbx' showing "Unable to run Pre-Asterisk hooks, because Asterisk is already running"
 | 
				
			||||||
 | 
					    # - /usr/sbin/asterisk -rx "core stop gracefully"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# - name: 'FreePBX - fix file permissions for NGINX: /etc/freepbx.conf (0644), /var/log/asterisk/freepbx.log (0666)'
 | 
					# - name: 'FreePBX - fix file permissions for NGINX: /etc/freepbx.conf (0644), /var/log/asterisk/freepbx.log (0666)'
 | 
				
			||||||
#   file:
 | 
					#   file:
 | 
				
			||||||
| 
						 | 
					@ -175,6 +175,13 @@
 | 
				
			||||||
    owner: "{{ apache_user }}"    # www-data
 | 
					    owner: "{{ apache_user }}"    # www-data
 | 
				
			||||||
    group: "{{ apache_user }}"
 | 
					    group: "{{ apache_user }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: FreePBX - Run 'systemctl restart freepbx' TWICE (THIS IS #1 OF 2) to get past 'systemctl status freepbx' glitch "Unable to run Pre-Asterisk hooks, because Asterisk is already running"
 | 
				
			||||||
 | 
					  systemd:
 | 
				
			||||||
 | 
					    daemon_reload: yes
 | 
				
			||||||
 | 
					    name: freepbx
 | 
				
			||||||
 | 
					    enabled: yes
 | 
				
			||||||
 | 
					    state: restarted
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: FreePBX - Add directive "Listen {{ pbx_http_port }}" to /etc/apache2/ports.conf
 | 
					- name: FreePBX - Add directive "Listen {{ pbx_http_port }}" to /etc/apache2/ports.conf
 | 
				
			||||||
  lineinfile:
 | 
					  lineinfile:
 | 
				
			||||||
    path: /etc/apache2/ports.conf
 | 
					    path: /etc/apache2/ports.conf
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue