URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       TGIF.Network
  HTML https://tgifnetwork.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Hotspot Discussions
       *****************************************************
       #Post#: 2320--------------------------------------------------
       Run a pi-star script using Pistar-Remote
   DIR By: VE3RD
       Date: February 7, 2020, 6:39 pm
       ---------------------------------------------------------
       If you want to run an existing pi-star script file, just edit
       two files as follows, then reboot
       Note the sample is for DMR. If you want YSF or P25, or NXDN,
       then make the appropriate changes.
       If you need help, email me at ve3rd@rac.ca
       File 1
       /etc/pistar-remote
       [enable]
       # Is the Pi-Star Remote Enabled? (true|false)
       enabled=true
       [keeper]
       # Keepers Information
       # Please use your own callsign here
       callsign=VE3RD
       [dmr]
       # TG commands
       svckill=9999999
       svcrestart=9999998
       reboot=9999997
       #use any name you like, but remember it for file 2 below.
       #The number can be anything you like, but I would suggest a 7
       digit number ending in an unused 7th digit
       master1=9999991
       master2=9999992
       #shutdown=9999996
       .
       File 2
       /usr/local/sbin/pistar-remote
       #Scroll Down to
       # DMR Control Options
       if config.has_option('dmr', 'svckill'):
       dmrstop = config.get('dmr', 'svckill')
       else:
       dmrstop = str(999999999999)
       .........................
       ## Add the following lines for your script. Note the use of the
       script names in file1
       if config.has_option('dmr', 'master1'):
       dmrmaster1 = config.get('dmr', 'master1')
       else:
       dmrmaster1 = str(999999999999)
       if config.has_option('dmr', 'master2'):
       dmrmaster2 = config.get('dmr', 'master2')
       else:
       dmrmaster2 = str(999999999999)
       ..............................................
       Scroll Down to the following
       # Now run the loop
       while True:
       ...............................
       # Parse the log lines
       for line in loglist:
       # We only care about logs in the last 60
       secs
       if line[3:22] >= logstampnowminus60sec
       and line[3:22] <= logstampnow:
       #Add the following lines replacing the path and script line with
       your own script,
       # DMR  run master1
       if str('received RF voice header
       from ' + keeperCall + ' to ' + dmrmaster1) in line:
       # Kill the Services
       os.system(r'sudo
       /home/pi-star/setmaster2.rsh 1')
       # DMR run start master2
       if str('received RF voice header
       from ' + keeperCall + ' to ' + dmrmaster2) in line:
       # Kill the Services
       os.system(r'sudo
       /home/pi-star/setmaster2.sh 2')
       Create The Script "setmaster2.sh" in /home/pi-star
       Cut and paste with the following into the file
       Make it executible  with the command  ' chmod 755 setmaster2.sh'
       #!/bin/bash
       ############################################################
       #  Set DMR Master Server from Pi-Star Remote               #
       #  Param 1 is the Address, Param 2 is the Port             #
       #  VE3RD                                      2020/02/07   #
       ############################################################
       set -o errexit
       set -o pipefail
       sudo mount -o remount,rw /
       #echo "Set DMR Master Server"
       if [ -z "$1" ]; then
       exit
       fi
       sudo sed -i '/\[DMR\]/!b;n;cEnable='"1"'' /etc/mmdvmhost
       sudo sed -i '/\[DMR Network\]/!b;n;cEnable='"1"''
       /etc/mmdvmhost
       sudo sed -i '/^\[/h;G;/DMR
       Network/s/\(Port=\).*/\162031/m;P;d'  /etc/mmdvmhost
       if [ "$1" = 1 ]; then
       sudo sed -i '/^\[/h;G;/DMR
       Network/s/\(Address=\).*/\1tgif.network/m;P;d'  /etc/mmdvmhost
       fi
       if [ "$1" = 2 ]; then
       sudo sed -i '/^\[/h;G;/DMR
       Network/s/\(Address=\).*/\1107.191.99.14/m;P;d'  /etc/mmdvmhost
       fi
       sudo /usr/local/sbin/mmdvmhost.service restart > /dev/null
       #Post#: 5638--------------------------------------------------
       Re: Run a pi-star script using Pistar-Remote
   DIR By: kq4rcz
       Date: January 17, 2025, 2:32 pm
       ---------------------------------------------------------
       Two questions.
       1)  Has this been tested?  I am getting an error, "Illegal
       option -o pipefail"
       2)  Is this supposed to switch between the networks called,
       "tgif.network" and "107.191.99.14" ?
       Thanks for the reply.
       *****************************************************
       Page 1 of 1