I\'m new to using cron job. I don\'t even know how to write it. I have tried to search from internet, but I still don\'t understand it well. I want to create a cron job that
Better use the project Cron in combination with the Linux cronjob for this task. It allows you to configure run times in your PHP Code, support background jobs and is easy to use.
First step call a PHP Script every minute:
* * * * * /usr/local/bin/run.php &> /dev/null
Second Step use the cron/cron Package to configure run times directly in PHP.
$deprecatedStatus = new ShellJob();
$deprecatedStatus->setCommand('cd /app && /usr/local/bin/php cron/updateDeprecatedStatus.php');
$deprecatedStatus->setSchedule(new CrontabSchedule('* * * * */2'));
$displayDate = new ShellJob();
$displayDate->setCommand('cd /app && /usr/local/bin/php cron/updateDisplayDate.php');
$displayDate->setSchedule(new CrontabSchedule('* * * * */5'));
You found the details how to use in the linked repository.