|
ssh登录moOde,将两个文件放入/var/www目录可以通过修css代码更改外观,也可以通过修改代码实现更多功能。
前端文件:service_control.html
后端文件:service_control.php
- <?php
- /**
- *
- * 音频设备控制面板(Audio device control panel)
- * ver:1.0.5
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * by:Androidnews
- */
- $allowedActions = array('start_mpd','stop_mpd','start_RoonServer','stop_RoonServer','start_lms','stop_lms','start_aplayer','stop_aplayer','start_diretta_ssync_host','stop_diretta_ssync_host','start_squeezelite','stop_squeezelite','start_naa','stop_naa','start_roonbridge','stop_roonbridge','start_aprenderer','stop_aprenderer','start_diretta_memoryplay_host','stop_diretta_memoryplay_host','start_direttatarget','stop_direttatarget','list_audio_devices','list_sysinfo','list_serviceinfo','shutdown_moOde','reboot_moOde');
- if (isset($_POST['action']) && in_array($_POST['action'], $allowedActions)) {
- $action = $_POST['action'];
- switch ($action) {
- case 'start_mpd':
- shell_exec('sudo systemctl start mpd.service 2>&1');
- $output = 'mpd服务已经启动...';
- break;
- case 'stop_mpd':
- shell_exec('sudo systemctl stop mpd.service 2>&1');
- $output = 'mpd服务已经停止...';
- break;
- case 'start_RoonServer':
- shell_exec('sudo systemctl start roonserver.service 2>&1');
- $output = 'RoonServer服务已经启动...';
- break;
- case 'stop_RoonServer':
- shell_exec('sudo pkill -f RoonServer 2>&1');
- $output = 'RoonServer服务已经停止...';
- break;
- case 'start_lms':
- shell_exec('sudo systemctl start lyrionmusicserver.service 2>&1');
- $output = 'LMS服务已经启动...';
- break;
- case 'stop_lms':
- shell_exec('sudo systemctl stop lyrionmusicserver.service 2>&1');
- $output = 'LMS服务已经停止...';
- break;
- case 'start_aplayer':
- shell_exec('sudo systemctl start aplayer.service 2>&1');
- $output = 'aplayer已经启动...';
- break;
- case 'stop_aplayer':
- shell_exec('sudo systemctl stop aplayer.service 2>&1');
- $output = 'aplayer已经停止...';
- break;
- case 'start_naa':
- shell_exec('sudo systemctl stop aplayer.service;sudo systemctl stop aprenderer.service;sudo systemctl stop squeezelite.service;sudo systemctl start networkaudiod.service;sudo pkill -f RoonBridge;sudo pkill -f RoonRoonServer; 2>&1');
- $output = 'NAA服务已经启动...';
- break;
- case 'stop_naa':
- shell_exec('sudo systemctl stop networkaudiod.service 2>&1');
- $output = 'NAA服务已经停止...';
- break;
- case 'start_aprenderer':
- shell_exec('sudo systemctl stop squeezelite.service;sudo systemctl stop networkaudiod.service;sudo systemctl start aprenderer.service;sudo pkill -f RoonBridge;sudo pkill -f RoonRoonServer; 2>&1');
- $output = 'aprenderer已经启动...';
- break;
- case 'stop_aprenderer':
- shell_exec('sudo systemctl stop aprenderer.service 2>&1');
- $output = 'aprenderer已经停止...';
- break;
- case 'start_diretta_memoryplay_host':
- shell_exec('sudo systemctl start diretta_memoryplay_host.service 2>&1');
- $output = 'DirettaMemoryPlay已经启动...';
- break;
- case 'stop_diretta_memoryplay_host':
- shell_exec('sudo systemctl stop diretta_memoryplay_host.service 2>&1');
- $output = 'DirettaMemoryPlay已经停止...';
- break;
- case 'start_diretta_ssync_host':
- shell_exec('sudo systemctl start diretta_ssync_host.service 2>&1');
- $output = 'DirettaSalsaHost已经启动...';
- break;
- case 'stop_diretta_ssync_host':
- shell_exec('sudo systemctl stop diretta_ssync_host.service 2>&1');
- $output = 'DirettaSalsaHost已经停止...';
- break;
- case 'start_direttatarget':
- shell_exec('sudo systemctl stop diretta_ssync_host.service;sudo systemctl start diretta.service 2>&1');
- $output = 'DirettaTarget已经启动...';
- break;
- case 'stop_direttatarget':
- shell_exec('sudo reboot 2>&1');
- $output = 'DirettaTarget停止...';
- break;
- case 'list_audio_devices':
- $output = shell_exec('sudo aplay -l 2>&1');
- break;
- case 'list_sysinfo':
- $output = shell_exec('sudo uptime&cat /proc/version & cat /proc/cpuinfo & cat /proc/meminfo 2>&1');
- break;
- case 'list_serviceinfo':
- $output = shell_exec('sudo systemctl list-units --type=service 2>&1');
- break;
- case 'shutdown_moOde':
- shell_exec('sudo shutdown -h now');
- $output = '系统正在关机...';
- break;
- case 'reboot_moOde':
- shell_exec('sudo reboot');
- $output = '系统正在重启...';
- break;
- default:
- $output = '无效的操作请求。';
- }
- if (isset($output)) {
- echo "<pre>" . htmlspecialchars($output) . "</pre>";
- }
- } else {
- echo "<p>无效的操作请求。</p>";
- }
- ?>
复制代码 界面:
|
|