I am new to PHP and need to run a screen session & send a character using stuff. My code is as below -
Call from the PHP code
if (!empty($key))
{
system("/bin/bash test.sh " . $key);
}
I create a screen called as arduino by below
/usr/bin screen -dmS arduino /dev/ttyUSB0 9600
Call from the script file from test.sh
/usr/bin screen -S arduino -X stuff "$1"$'
'
Is the format using 'stuff' command right - i want to send a character like x,w,d followed by 'enter'.
I have added my user to www-data already. I have checked PHP.ini but nothing out of ordinary. My web server is Apache2 and runs on /var/www
Any suggestions please?