How can I run a cron task in Linux?
Following this Q&A,I have this cron task to run - just writing some info to a txt file,
// /var/www/cron.php
$myfile = fopen("cron.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
But after adding the cron task via my terminal,
crontab -e
and then,
* * * * * /usr/bin/php /var/www/cron.php &> /dev/null
But when I open cron.txt, there is nothing in it.
Why? What have I missed?