Answer the question
In order to leave comments, you need to log in
How to run a script for linux Centos7 without errors?
Good day. Faced such a problem. I'm testing a zabbix monitoring system. I'm trying to connect Asterisk 13 to a trunk monitoring system. I found on the site https://serveradmin.ru/monitoring-asterisk-v-zabbix/ a link to a script for monitoring sip trunks. When running the script, an error occurs
Script in use
#!/bin/bash
# Получаем количество всех транков в системе
total=`sudo asterisk -rx 'sip show registry' | sed -n '/registrations/p' | awk '{print $1}'`
# Получаем число активных транков
active=`sudo asterisk -rx 'sip show registry' | sed -n '/Registered/p' | wc -l`
# Получаем имена транков с проблемам
offline=`sudo asterisk -rx 'sip show registry' | sed -n '/Request\|Rejected\|Authentication\|Auth/p' | awk '{print $3}'`
# Сравниваем общее число с числом активных транков и выводим сообщение об их состоянии
if [ $active -lt $total ]
then
echo Trunks offline $offline
else
echo All trunks are online
fi
Answer the question
In order to leave comments, you need to log in
remove the screw line endings from the file - you see the ^M error in the text.
remove for example using dos2unixdos2unix file.txt
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question