added a sudoers file; refined handling of success/error
This commit is contained in:
parent
b933ad4fc9
commit
970c5e1df6
2
conf/restarter
Normal file
2
conf/restarter
Normal file
@ -0,0 +1,2 @@
|
||||
# sudoers entry for package restarter
|
||||
www-data unterdemradar=NOPASSWD: /usr/bin/systemctl restart minidlna.service
|
||||
@ -20,8 +20,8 @@ console.log(query);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- <button type=button onClick="restart('sudo systemctl restart minidlna.service')">MiniDLNA</button> -->
|
||||
<button type=button onClick="restart('ls -al')">MiniDLNA</button>
|
||||
<!-- PHP built-in web server: php -S [IP]:[port] -t [path]</pre></p> -->
|
||||
<div id="result">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
}
|
||||
// execute shell command
|
||||
exec($command, $output, $exitcode);
|
||||
echo "Output is <pre>", join("<br>", $output), "</pre><br>";
|
||||
echo "Exit code is ", $exitcode;
|
||||
echo "Output is <pre>", join("<br>", $output), "</pre><br>";//DEBUG
|
||||
if ( $exitcode == "0" ) {
|
||||
echo "Success";
|
||||
} else {
|
||||
echo "Command failed with exit code", $exitcode;
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user