This PHP code should start a shell script at the time saved in the $start
variable and at the time saved in the $end
variable. All Files are chmod a+rwx
. It works on command line but not in shell_exec()
, also the $start
and $end
variables are in the correct time Format hh:mm
. I found this other Post in which someone had a similar Problem but nothing posted there helped me.
if ($_POST["device"] == "Ventilator") {
$start = $_POST["start"];
$end = $_POST["end"];
if ($_POST["start"] != "0") {
shell_exec('echo "/home/pi/IOT/gpio21high.sh" | at $start');
echo "$start".
"<br />";
}
if ($_POST["end"] != "0") {
shell_exec('echo "/home/pi/IOT/gpio21low.sh" | at $end');
echo "$end".
"<br />";
}
}
";' gets executed every time, so 'else{}' is useless , but you are right in the logfile it said "You do not have permission to use at." . i gave the .sh and the .php file 'a+rwx' rights, do you have an idea what i was missing ? – Michael Santos Oct 04 '18 at 03:02