I have a database where uploaded music details are stored.
In my database I have location of music stored
Data of Table is like this:
TableA
id musicpath status
1 /X/Y/Z/abc.mp3 1
2 /X/Y/Z/abc1.mp3 0
3 /X/Y/Z/abc3.p3 1
4 /X/Y/Z/abc5mp3 1
In the above table, id is auto-increment, and musicpath is the location where music is stored. If the status of any row is 1, cron will run and compress the uploaded music and replace the existing file and the status will be updated to 0. I have ffmpeg installed and I can compress using ssh but through PHP I tried but its not working so i have decided to write CRON
cron will execute this code for compressing but other details if any one can share it wil be a great help.
exec('ffmpeg -y -i ' . $_FILES['song']['name'] . ' -ab 24000 ' . $_FILES['song']['name'] . '');
i know how to setup cron to execute the php file . but i dont know how to write php file which will be executed by cron.
You can simply add a shebang line to your PHP script and make it executable (
chmod +x):Then you can use it in the crontab like any other script/program, i.e.
/path/to/whatever.php.