reboot function added
authorNeszt Tibor <neszt.tibor@euronetrt.hu>
Thu, 7 Dec 2017 14:16:50 +0000 (15:16 +0100)
committerNeszt Tibor <neszt.tibor@euronetrt.hu>
Thu, 7 Dec 2017 14:16:50 +0000 (15:16 +0100)
index.php
js/main.js

index 90d5c1f..07ffa60 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -85,6 +85,10 @@ if ( isset($_GET['config']) ) {
 
                exec("screen -X -S yawep_screen_player quit");
        }
+       if ( isset($_GET['reboot']) ) {
+
+               exec("sudo reboot");
+       }
        if ( isset($_GET['bgonoff']) ) {
                if ( $_GET['bgonoff'] == 'true' ) {
                        $config['is_bg'] = 1;
@@ -151,8 +155,9 @@ if ( isset($_GET['config']) ) {
        print "</table>";
        print "<hr/>";
        print "<button type=\"button\" class=\"btn btn-success\" name=\"start\">Start</button>";
-       print "<button type=\"button\" class=\"btn btn-danger\" name=\"stop\" >Stop</button>";
+       print "<button type=\"button\" class=\"btn btn-warning\" name=\"stop\" >Stop</button>";
        print "<button type=\"button\" class=\"btn btn-info\" name=\"status\" >Status</button>";
+       print "<button type=\"button\" class=\"btn btn-danger\" name=\"reboot\" >Reboot</button>";
        print "<input type=\"checkbox\" name=\"bgonoff\" id=\"checkbox1\" $is_bg_checked_html><label for=\"checkbox1\">Show background</label></div>";
        print "<input type=\"checkbox\" name=\"bootonoff\" id=\"checkbox2\" $is_boot_checked_html><label for=\"checkbox2\">Start on boot</label></div>";
        print "<hr/>";
index c35296c..55f9cff 100644 (file)
@@ -113,6 +113,20 @@ function init() {
                                ;
                        })
        });
+       $('button[name=reboot]').click(function() {
+               $.ajax({
+                       type: 'GET',
+                       url: 'index.php',
+                       dataType: 'json',
+                       data: { config: '1', reboot: '1'}
+               })
+                       .done(function(msg) {
+                               ;
+                       })
+                       .fail(function(msg) {
+                               ;
+                       })
+       });
        $('button[name=status]').click(function() {
                $.ajax({
                        type: 'GET',