Changes

Jump to navigation Jump to search
Line 1: Line 1: −
[[Category: How To]]
+
[[Category: How to]]
 
PTTLink for beginners.
 
PTTLink for beginners.
   Line 344: Line 344:  
[[File:108_diag_menu_g.png|none|thumb|640x640px]]
 
[[File:108_diag_menu_g.png|none|thumb|640x640px]]
    +
== Ensure the nodelist is downloading ==
 +
Before your node will connect it needs to have the nodelist available.  This file will automatically be downloaded by systems support scripts and placed into /var/lib/asterisk/rpt_nodes.
 +
 +
If for some reason your node never downloads the nodelist, it may mean you are missing the required support scripts and configuration.
 +
 +
=== Add missing NodeUpdate.sh and NodeNameUpdate.sh scripts ===
 +
Copy the following if you are missing the scripts below in /usr/local/bin and do not have contab entries that call them
 +
 +
* Copy the following to /usr/local/bin/NodeUpdate.sh
 +
<syntaxhighlight lang="sh">
 +
#!/bin/bash
 +
#
 +
# A cron job script for downloading the extnodes file with error reporting
 +
#
 +
#
 +
# This is intended to be run from cron every 5 min
 +
#  Copyright 2018 Bryan Fields
 +
#  Licensed under the GNU GPLv2
 +
 +
URL="http://register.pttlink.org/cgi-bin/gennodes.php"
 +
FILEPATH=/var/lib/asterisk
 +
 +
#sleep for a random time of 0-300 seconds
 +
#sleep $[( $RANDOM % 299 )  + 1 ]s
 +
 +
 +
# use curl in silent and compressed mode, connect timeout of 5 and
 +
# -f for fail with an error code of 22 on server errors
 +
#-m 20 is a max time for the whole process of 20 seconds
 +
curl -s --compressed --connect-timeout 5 -f -m 20 -o /tmp/rpt_extnodes-temp $URL
 +
#curl --connect-timeout 5 -f -m 20 -o /tmp/rpt_extnodes-temp $URL
 +
exitcode=$?
 +
if [ "$exitcode" = "0" ]; then
 +
    grep -q extnodes /tmp/rpt_extnodes-temp
 +
        if [ $? -eq "0" ] ;then
 +
            chmod 700 /tmp/rpt_extnodes-temp
 +
            cp /tmp/rpt_extnodes-temp $FILEPATH/rpt_extnodes-temp
 +
            mv -f $FILEPATH/rpt_extnodes-temp $FILEPATH/rpt_extnodes
 +
            whenandwhere=`grep "Generated at" /tmp/rpt_extnodes-temp |cut -c2-100`
 +
            #don't print out on good run
 +
    #echo "NodeUpdate installed a new nodes list $whenandwhere"
 +
    logger -i "NodeUpdate installed a new nodes list $whenandwhere"
 +
        else
 +
            #echo "NodeUpdate failed to parse node list; node list not updated"
 +
    logger -i "NodeUpdate failed to parse node list; node list not updated"
 +
            exit 1
 +
        fi
 +
 +
else
 +
    #echo "NodeUpdate could not get nodes list from server"
 +
    logger -i "NodeUpdate could not get nodes list from server"
 +
    exit 1
 +
fi
 +
exit 0
 +
</syntaxhighlight>
 +
* Copy the following to /usr/local/bin/NodeNameUpdate.sh
 +
<syntaxhighlight lang="sh">
 +
#!/bin/bash
 +
#
 +
# A cron job script for downloading custom node announcements with error reporting
 +
#
 +
# This is intended to be run from cron every 8 hours and will randomly insert a delay from 0-8 hours
 +
#
 +
#  Copyright 2018 Bryan Fields
 +
#  Licensed under the GNU GPLv2
 +
 +
URL="rsync://rsync.pttlink.org/connect-messages"
 +
FILEPATH="/var/lib/asterisk/sounds/rpt/nodenames"
 +
 +
#sleep for a random time of 0-28800 seconds (8 hours)
 +
sleep $[ ( $RANDOM % 28799 )  + 1 ]s
 +
 +
#assign the filesUpdated var with the number of files changed by rsync.  This is nasty, but it works.
 +
 +
filesUpdated=`rsync -a --stats $URL $FILEPATH |grep "Number of regular files transferred" | cut -c 38-50`
 +
exitcode=$?
 +
if [ "$exitcode" = "0" ]; then
 +
    if [ "$filesUpdated" = "0" ]; then
 +
echo "NodeNameUpdate run with no updates"
 +
logger -i "NodeNameUpdate run with no updates"
 +
    elif [ "$filesUpdated" > "0" ]; then
 +
echo "NodeNameUpdate updated $filesUpdated nodenames"
 +
        logger -i "NodeNameUpdate updated $filesUpdated nodenames"
 +
    fi
 +
else
 +
    echo "NodeNameUpdate failed"
 +
    logger -i "NodeUpdate failed"
 +
    exit 1
 +
fi
 +
exit 0
 +
</syntaxhighlight>
 +
* Add entries to crontab
 +
<syntaxhighlight lang="text">
 +
0 0,8,16 * * * root /usr/local/bin/NodeNameUpdate.sh > /dev/null 2>&1
 +
*/5 * * * * root /usr/local/bin/NodeUpdate.sh > /dev/null 2>&1
 +
01 03 * * * cd /var/www/html/allmon2; ./astdb.php
 +
</syntaxhighlight>
 +
 +
== PTTLink Configuration Updates ==
 
Run the following commands to add PTTLink server address.
 
Run the following commands to add PTTLink server address.
   −
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/rc.updatenodelist
+
<pre>
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/NodeNameUpdate.sh
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/rc.updatenodelist
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/NodeUpdate.sh
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/NodeNameUpdate.sh
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/rpt.conf
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /usr/local/bin/NodeUpdate.sh
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/iax.conf
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/rpt.conf
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/extensions.conf
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/iax.conf
sudo service asterisk restart
+
sudo sed -i 's/allstarlink.org/pttlink.org/g' /etc/asterisk/extensions.conf
 +
 
 +
sudo sed -i 's/allstarlink.org/pttlink.org/g' /var/www/html/allmon2/astdb.php
 +
sudo sed -i 's/Allstar /PTTLink / g' /var/www/html/allmon2/header.inc
 +
sudo sed -i 's/allstarlink.org/pttlink.org/g' /var/www/html/allmon2/link.php
 +
 
 +
sudo service asterisk restart
 +
</pre>
 +
 
 +
Edit the following file with:
 +
 
 +
<pre>
 +
sudo nano /usr/local/sbin/astdb.php
 +
</pre>
 +
 
 +
Replace line:
 +
 
 +
<pre>
 +
$url = "https://allstarlink.org/cgi-bin/allmondb.pl";
 +
</pre>
 +
 
 +
with:
 +
 
 +
<pre>
 +
$url = "http://allmondb.pttlink.org";
 +
</pre>
    
Restart your system.
 
Restart your system.

Navigation menu