How to run roscore from php using shell script?
Hi, Need help to figure out how to execute roscore
or launch files from the web.
To do this, I created startup.php
that calls a startup.sh
file from the web. This shell script calls the roscore
command. The echo is printed out however, the roscore
command does not run.
startup.php
<?php
if ($_GET['run']) {
# This code will run if ?run=true is set.
$output = shell_exec("sh /var/www/html/startup.sh");
echo "<pre>$output</pre>";
}
?>
# This code will run if ?run=true is set.
$output = shell_exec("sh /var/www/html/ros_startup.sh");
echo "<pre>$output</pre>";
}
?>
<!-- This link will add ?run=true to your URL, myfilename.php?run=true -->
<a href="?run=true">Click Me!</a>
startup.sh
#!/bin/bash
clear
echo "Start..."
source /opt/ros/kinetic/setup.bash
roscore
echo "Completed..."
I replicated just the bash script and on it runs the roscore. Is there I am missing?