Some setup background first:
I have a cronjob which runs a PHP file called worker_cronjob. All the file does is download my worker from git and the cronjob in cron.d looks like:
*/1 * * * * ubuntu /home/ubuntu/worker_cronjob >> /home/ubuntu/worker.log
It includes the worker_despatcher file
Which fires off a child process with (ROOT being an abolsute path to my directory):
$PID = exec(sprintf("%s > %s 2>&1 & echo $!", "php ".ROOT."/worker/encoder.php".$arg_string, ROOT."/worker/encoder.log"));
The problem is that under a cronjob this method is changing the way system commands are run, more specifically sh. So when I run a command like:
ffmpeg
It returns:
sh: 1: ffmpeg: command not found
After trail and error I have discovered this only happens from the cronjob, somehow it is changing the way directories are set, much like chrooting without me calling chroot.
I have looked at other threads and it says it use full paths when creating cronjobs and running files, however it's not my files that's the problem and they are all referenced via absolute paths, it is running installed programs where I get problems.
Does the absolute path apply to installed apps as well or is there a way to break this functionality to give me back the ability to just run a command with one word?