.
, , , , , BIG MESS, php script apache. , , , , . , TTY. , sudo -i MANY MANY attmepts php, , , , , SSH " , . , , WAY overkill, , -, php ( -).
, , , , :
php script /tmp , :
exec "sudo -u <username> /usr/bin/say -o /tmp/outputfile.aiff --voice=Ava \"<What to Say>\"";
, , , (, , ) apache/php, - script ssh . , :
exec "sudo -u <username> -i ~<username>/expectscript";
script :
spawn /usr/bin/ssh localhost
expect "Password"
send "<PASSWORD>\r"
expect "<username>"
send "/usr/bin/afplay /tmp/outputfile.aiff\r"
expect "<username>"
send "/usr/bin/touch /tmp/touchthis\r"
expect "<username>"
send "exit\r"
, <username> ( < > ) <PASSWORD> . , script, bash , , script, . - , script , , .
, , , . , , Automator PHP ( ). , , . , , ( php ), Apache/PHP.