I'm trying to setup a cronjobs in cakephp3, I can create a command class
class RescanCommand extends Command {
public function sendMail() {
$email = new Email();
// Sample SMTP configuration.
Email::setConfigTransport('mailtrap', [
'host' => 'smtp.mailtrap.io',
'port' => 25,
'username' => 'username',
'password' => 'pass',
'className' => 'Smtp'
]);
$email->setFrom(['test@test.com' => 'CSV file'])
->setTo('test@test.com')
->setSubject('CSV Link File')
->send('Please find attached a copy of the links');
}
public function execute(Arguments $args, ConsoleIo $io) {
$this->sendMail();
}
}
in order to setup the cronjob, I have to login to cpanel and create a cronjob in the format
for setting up the cronjob in cakephp I have to write
- cd /Application/MAMP/htdocs/music && bin/cake rescan execute
my question is how can I make the cronjob for the server and access it through the cpanel, I need to have the script in the webroot to access.
any help would be appreciate it.