diff --git a/strassenkind.php b/strassenkind.php
index 03d600b..3e1f0f0 100644
--- a/strassenkind.php
+++ b/strassenkind.php
@@ -34,17 +34,8 @@ echo "Done.";
} else {
echo "
";
}
- ?>
- $command \n $output
\n
";
- }
- } else {
- //run status command list otherwise
- foreach ($status_commands as $command) {
+ function execute_command_list($commands){
+ foreach ($commands as $command) {
if ($command != ""){
// === is here on purpose.
if (strpos($command, '>') === false) {
@@ -54,6 +45,15 @@ echo "Done.";
echo " $command
\n $output
\n
";
}
}
+
+ }
+
+ // run ondemand command list if demanded
+ if (isset($_POST['ondemand'])) {
+ execute_command_list($ondemand_commands);
+ } else {
+ //run status command list otherwise
+ execute_command_list($status_commands);
}
?>