I try to restart my LTE modem via cron. I have a PHP file (restart.php) with exec() function:
exec('usb_modeswitch -R -v 12d1 -p 1436');
It works fine if I type in console (as root):
php restart.php
But not works via crontab (for root):
*/10 * * * * php /var/www/html/modem/restart.php
I have 777 permissions for restart.php file and the path is ok.
What is wrong? And how I can fix it? Any ideas?
Please, help
I added a full path to usb_modeswitch and it solved my problem:
exec('/usr/sbin/usb_modeswitch -R -v 12d1 -p 1436');
Rob Ruchte, Thank u for solution
Try to use full path in crontab for php and in php script. You can find where is php binary by this command:
whereis php