mirror of https://gitlab.com/hp3icc/emq-TE1.git
Create allmon3.sh
This commit is contained in:
parent
06a22ce171
commit
b3edb8a9f1
|
|
@ -0,0 +1,149 @@
|
|||
#!/bin/bash
|
||||
if systemctl is-active "apache2" >/dev/null 2>&1; then
|
||||
sapache = 1
|
||||
else
|
||||
sapache = 0
|
||||
fi
|
||||
if [ ! -d "/etc/allmon3" ]; then
|
||||
samllm3 = 1
|
||||
source /etc/os-release
|
||||
|
||||
if [ "$VERSION_ID" == "11" ]; then
|
||||
if ! grep -q 'Raspberry' /proc/cpuinfo; then
|
||||
#Install on Debian 11 / Raspian 11 Software
|
||||
|
||||
# Enable the Debian 11 bullseye-backports package repositorty:
|
||||
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
|
||||
gpg --export 0E98404D386FA1D9 | sudo apt-key add -
|
||||
gpg --export 6ED0E7B82643E131 | sudo apt-key add -
|
||||
echo "deb https://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/bullseye-backports.list
|
||||
apt-get update
|
||||
|
||||
# Install the dependencies
|
||||
|
||||
apt install -y apache2 python3-argon2
|
||||
apt install -y -t bullseye-backports python3-websockets python3-aiohttp python3-aiohttp-session
|
||||
|
||||
# Install Allmon3
|
||||
|
||||
wget https://github.com/AllStarLink/Allmon3/releases/download/rel_t_1_0_2/allmon3_1.0.2-1_all.deb
|
||||
dpkg -i allmon3_1.0.2-1_all.deb
|
||||
else
|
||||
samllm3 = 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "/etc/allmon3" ]; then
|
||||
samllm3 = 1
|
||||
source /etc/os-release
|
||||
|
||||
if [ "$VERSION_ID" == "10" ]; then
|
||||
#Install Debian 10 / Raspian 10 Software
|
||||
|
||||
# Enable the Debian 10 buster-backports package repository:
|
||||
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
|
||||
gpg --export 04EE7237B7D453EC | sudo apt-key add -
|
||||
gpg --export 648ACFD622F3D138 | sudo apt-key add -
|
||||
echo "deb https://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/buster-backports.list
|
||||
apt update -y
|
||||
|
||||
# Install the dependendencies
|
||||
|
||||
apt install -y apache2 python3-argon2
|
||||
apt install -y -t buster-backports python3-async-timeout python3-attr python3-multidict python3-yarl
|
||||
|
||||
# Install Python modules using PIP3
|
||||
|
||||
apt remove python3-aiohttp python3-websockets
|
||||
pip3 install aiohttp
|
||||
pip3 install aiohttp_session
|
||||
pip3 install websockets
|
||||
|
||||
# Update the CA Certificate chain since Debian 10 is out of support
|
||||
|
||||
apt install ca-certificates
|
||||
update-ca-certificates --fresh
|
||||
|
||||
# Install Allmon3 (debian10 version)
|
||||
|
||||
wget https://github.com/AllStarLink/Allmon3/releases/download/rel_t_1_0_2/allmon3_1.0.2-1_all.deb
|
||||
dpkg -i allmon3_1.0.1-2_all.deb
|
||||
else
|
||||
samllm3 = 0
|
||||
fi
|
||||
fi
|
||||
if [ -f "/etc/allmon3/allmon3.ini" ]; then
|
||||
cat > "/etc/allmon3/allmon3.ini" <<- "EOFX"
|
||||
;
|
||||
; This is the master configuration file for all ASL/Asterisks node-related
|
||||
; information. It is used for all server daemon processes
|
||||
; (e.g. asl-statmon, asl-cmdlink) and the web interface/API.
|
||||
;
|
||||
; Each configuration item below is marked (R) or (O) for required or optional
|
||||
; repsectively along with usage notes. The value in the table below is the
|
||||
; default value for optiional items or examples for required items.
|
||||
;
|
||||
; [1999]
|
||||
; host = 192.0.2.0 # (R) DNS name or IP address of the Asterisk/ASL node
|
||||
;
|
||||
; port = 5038 # (O) port of the Asterisk manager
|
||||
;
|
||||
; user = admin # (R) username of the Asterisk monitor, most
|
||||
; # commonly 'admin'
|
||||
;
|
||||
; pass = password # (R) password of the monitor user
|
||||
;
|
||||
; multinodes = # (O) this node is a server hosting multiple nodes
|
||||
; # and this is the "primary" record for the host.
|
||||
;
|
||||
; voters = n[,n,...] # (O) List voters on this server, comma
|
||||
; # separate. No value disabled voters
|
||||
;
|
||||
; pollinterval = 1 # (O) polling interval to asterisk in seconds
|
||||
; # default is 1. this value can be expressed as
|
||||
; # a decimal fraction of a second - e.g., .5
|
||||
; # is 500ms, .375 is 375ms, etc.
|
||||
;
|
||||
; vpollinterval = 1 # (O) broadcast interval of voter data in seconds
|
||||
; # default is 1. this value can be expressed as
|
||||
; # a decimal fraction of a second - e.g., .5
|
||||
; # is 500ms, .375 is 375ms, etc.
|
||||
;
|
||||
; retryinterval = 15 # (O) seconds between retries if initial connection to
|
||||
; # asterisk is lost (optional, default 15)
|
||||
;
|
||||
; retrycount = # (O) number of times to retry a lost asterisk
|
||||
; # connection before ending (default infinite)
|
||||
|
||||
; For a basic installation, you chould be able to uncomment the below,
|
||||
; change 1999 to your node number and set the pass= as
|
||||
; set in asterisk/manager.conf
|
||||
;[1999]
|
||||
;host=127.0.0.1
|
||||
;user=admin
|
||||
;pass=password
|
||||
|
||||
[a5a4a3a2a1]
|
||||
host=127.0.0.1
|
||||
user=admin
|
||||
pass=a2b2c2d2e2
|
||||
|
||||
|
||||
EOFX
|
||||
fi
|
||||
if [ $samllm3 = 1 ]; then
|
||||
systemctl disable allmon3
|
||||
systemctl stop allmon3
|
||||
fi
|
||||
if [ $sapache = 1 ]; then
|
||||
systemctl stop apache2
|
||||
systemctl start apache2
|
||||
systemctl enable apache2
|
||||
else
|
||||
systemctl stop apache2
|
||||
systemctl disable apache2
|
||||
fi
|
||||
Loading…
Reference in New Issue