Forum Replies Created
-
AuthorPosts
-
Jason, KM6TMXUser
is this the right repo? it hasnt been updated in a couple of years.
htt ps:// github.com/OpenRepeater/openrepeater
Jason, KM6TMXUserI suppose the hipster use github.
Jason, KM6TMXUserI suppose hipsters use github. Look ma, my first git.
Jason, KM6TMXUserI think the site must filter our URLs. I have added this to github
htt ps:// github.com/jm650/openrepeater
thanks,
j.Jason, KM6TMXUseranyone following my foot steps should locate that cli script outside of the document root of the server otherwise someone might DoS your svxlink process by calling it over and over again.
below is an a wrapper that handles the database updates and calls update_svxlink_cli.php
I have been running it as root, but any user that can write openrepeater.db and restart processes with systemctl should be sufficient.
here is the code for my wrapper
— cut here —
#!/bin/bash # # jason at broken.net # kid tested, and mother approved exitcode=1 if [ $# -ne 1 ]; then if [ $# -gt 1 ]; then echo -e "too many arguments. $# is not 1. Please try again" fi echo -e "ie. $0 name_of_tone\n" echo -e "ie. $0 TelRing.wav\n" echo -e "valid tones are located in /var/lib/openrepeater/sounds/courtesy_tones. Take a look\n" exit $exitcode fi tone=$1 if [ ! -e "/var/lib/openrepeater/sounds/courtesy_tones/$tone" ]; then exitcode=$((Sum=$exitcode+1)) echo "A courtesy tone by this name does not exist. Please check /var/lib/openrepeater/sounds/courtesy_tones for available tones." exit $exitcode fi echo update settings set value=\"$tone\" where keyID=\"courtesy\" | sqlite3 /var/lib/openrepeater/db/openrepeater.db php ./svxlink_update_cli.php if [ $? -eq 0 ]; then echo Successfully updated. else echo php returned an error. I did my best. fi
Jason, KM6TMXUserOkay, this seems to work…
sqlite> select * from settings where keyID=’courtesy’;
courtesy|_TelRing.wav
sqlite> update settings set value=’_power-down.wav’ where keyID=’courtesy’;
sqlite> select * from settings where keyID=’courtesy’;
courtesy|_power-down.wav
sqlite>
root@openrepeater:/var/www/openrepeater/functions# php svxlink_update_cli.phpForgive my crude patch. My last php effort was almost 20 years ago. Is there a process to contribute?
— cut here —
root@openrepeater:/var/www/openrepeater/functions# diff svxlink_update.php svxlink_update_cli.php 11,16d10 < /* SESSION CHECK TO SEE IF USER IS LOGGED IN. */ < session_start(); < if ((!isset($_SESSION['username'])) || (!isset($_SESSION['userID']))){ < header('location: login.php'); < } else { // If they are, show the page. < /* ---------------------------------------------------------- */ 27c21,28 < require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/includes/autoloadClasses.php'); --- > > putenv("DOCUMENT_ROOT=/var/www/openrepeater"); > require_once('/var/www/openrepeater/includes/autoloadClasses.php'); > require_once('/var/www/openrepeater/includes/classes/Database.php'); > require_once('/var/www/openrepeater/includes/classes/SVXLink.php'); > require_once('/var/www/openrepeater/includes/classes/SVXLink_TCL.php'); > require_once('/var/www/openrepeater/includes/classes/SVXLink_GPIO.php'); > 190,202d190 < /* WHAT PAGE TO GO BACK TO */ < if (isset($_POST["return_url"])) { < // Return to page that sent here < $url = strtok($_POST["return_url"], '?'); //Clean parameters from URL < header('location: '.$url); < } else if (isset($_SESSION["new_repeater_settings"])) { < // Wizard was run. Go ahead and destroy session and logout < session_destroy(); < header('location: ../login.php'); < } else { < // Otherwise just go to dashboard < header('location: ../dashboard.php'); < } 205,210d192 < <?php < /* ---------------------------------------------------------- */ < // SESSION CHECK TO SEE IF USER IS LOGGED IN. < } // close ELSE to end login check from top of page < /* ---------------------------------------------------------- */ < ?>
- This reply was modified 3 years, 9 months ago by Jason, KM6TMX.
Jason, KM6TMXUserOh, maybe you provided the answer already in /var/www/openrepeater/functions/svxlink_update.php
i will look at modifying that for CLI use.
Jason, KM6TMXUserOkay, I am cool restarting svxlink, for now. I see it as having to rarely restart it due to power outages. And I can put some hysteresis by waiting a few minutes before executing the change. If the power is not back within 20 minutes it is probably going to be out for hours.
What I am missing is some glue code. I can update openrepeater.db easily enough, as I previously mentioned. The question really is, how do I execute the rebuild process to transfer the settings from openrepeater.db to the config files?
The UI clearly does it at the push of a button. Can I execute the process some how with the scripts on hand? If not, which file(s) do this in the UI? Perhaps I can manipulate them to work from CLI.
thanks,
j. -
AuthorPosts