Skip to content

A live bird collage card for your Home Assistant dashboard.

Fix error when restarting the Live Stream service

jaredb7d16d4f60a361
diff --git a/homepage/views.php b/homepage/views.php
index 65811119..21304fe1 100644
--- a/homepage/views.php
+++ b/homepage/views.php
@@ -271,10 +271,10 @@ if(isset($_GET['view'])){
} else {
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
$submitteduser = $_SERVER['PHP_AUTH_USER'];
- $allowedCommands = array('sudo systemctl stop livestream.service && sudo /etc/init.d/icecast2 stop',
- 'sudo systemctl restart livestream.service && sudo /etc/init.d/icecast2 restart',
- 'sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo /etc/init.d/icecast2 stop',
- 'sudo systemctl enable icecast2 && sudo /etc/init.d/icecast2 start && sudo systemctl enable --now livestream.service',
+ $allowedCommands = array('sudo systemctl stop livestream.service && sudo systemctl stop icecast2.service',
+ 'sudo systemctl restart livestream.service && sudo systemctl restart icecast2.service',
+ 'sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo systemctl stop icecast2.service',
+ 'sudo systemctl enable icecast2 && sudo systemctl start icecast2.service && sudo systemctl enable --now livestream.service',
'sudo systemctl stop web_terminal.service',
'sudo systemctl restart web_terminal.service',
'sudo systemctl disable --now web_terminal.service',
diff --git a/scripts/service_controls.php b/scripts/service_controls.php
index faf4da44..18885995 100644
--- a/scripts/service_controls.php
+++ b/scripts/service_controls.php
@@ -25,10 +25,10 @@ function service_status($name) {
<div class="servicecontrols">
<form action="" method="GET">
<h3>Live Audio Stream <?php echo service_status("livestream.service");?></h3>
- <button type="submit" name="submit" value="sudo systemctl stop livestream.service && sudo /etc/init.d/icecast2 stop">Stop</button>
- <button type="submit" name="submit" value="sudo systemctl restart livestream.service && sudo /etc/init.d/icecast2 restart">Restart </button>
- <button type="submit" name="submit" value="sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo /etc/init.d/icecast2 stop">Disable</button>
- <button type="submit" name="submit" value="sudo systemctl enable icecast2 && sudo /etc/init.d/icecast2 start && sudo systemctl enable --now livestream.service">Enable</button>
+ <button type="submit" name="submit" value="sudo systemctl stop livestream.service && sudo systemctl stop icecast2.service">Stop</button>
+ <button type="submit" name="submit" value="sudo systemctl restart livestream.service && sudo systemctl restart icecast2.service">Restart </button>
+ <button type="submit" name="submit" value="sudo systemctl disable --now livestream.service && sudo systemctl disable icecast2 && sudo systemctl stop icecast2.service">Disable</button>
+ <button type="submit" name="submit" value="sudo systemctl enable icecast2 && sudo systemctl start icecast2.service && sudo systemctl enable --now livestream.service">Enable</button>
</form>
<form action="" method="GET">
<h3>Web Terminal <?php echo service_status("web_terminal.service");?></h3>